Container com logs
This commit is contained in:
parent
2cf31baf66
commit
e76f2c5e9c
|
|
@ -15,7 +15,6 @@ COPY migrations ./migrations
|
||||||
|
|
||||||
RUN chmod +x start.sh
|
RUN chmod +x start.sh
|
||||||
ENV FLASK_APP=rifaserver.app
|
ENV FLASK_APP=rifaserver.app
|
||||||
|
ENV GUNICORN_BIND=:5000
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
# CMD ["gunicorn", "-b", ":5000", "rifaserver.app:app", "--access-logfile", "-", "--error-logfile", "-"]
|
|
||||||
# "--access-logformat", "%({x-forwarded-for}i)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\""]
|
|
||||||
CMD ["./start.sh"]
|
CMD ["./start.sh"]
|
||||||
|
|
|
||||||
|
|
@ -67,15 +67,18 @@ def create_app():
|
||||||
|
|
||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
|
|
||||||
with app.app_context():
|
|
||||||
if not os.path.isfile(os.path.join(app.instance_path, 'raffle.db')):
|
if not os.path.isfile(os.path.join(app.instance_path, 'raffle.db')):
|
||||||
|
print('Criando novo banco de dados `raffle.db`')
|
||||||
|
with app.app_context():
|
||||||
db.create_all()
|
db.create_all()
|
||||||
stamp()
|
stamp()
|
||||||
|
import sys
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
scheduler.add_job(func=backup_db, args=(app.instance_path,), trigger="interval", hours=1)
|
scheduler.add_job(func=backup_db, args=(app.instance_path,), trigger="interval", hours=1)
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
# print('App created!!')
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
9
start.sh
9
start.sh
|
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# flask --app rifaserver.app apply_migrations
|
export PYTHONUNBUFFERED=1
|
||||||
|
exec gunicorn -b $GUNICORN_BIND --access-logfile - --error-logfile - $FLASK_APP:app
|
||||||
exec gunicorn -b :5001 rifaserver.app:app --access-logfile - --error-logfile -
|
# exec /bin/bash
|
||||||
# CMD ["gunicorn", "-b", ":5000", "rifaserver.app:app", "--access-logfile", "-", "--error-logfile", "-"]
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue