Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Chiefs
ChiefSend
Commits
d8c863e2
Commit
d8c863e2
authored
Oct 24, 2020
by
Lukas Bhm
Browse files
use .env files
parent
91c542df
Changes
4
Hide whitespace changes
Inline
Side-by-side
.env
0 → 100644
View file @
d8c863e2
Dockerfile
View file @
d8c863e2
...
...
@@ -16,4 +16,4 @@ ENV FLASK_APP chiefsend.py
EXPOSE
5000
EXPOSE
6379
ENTRYPOINT
gunicorn -b :5000 --workers=3
--worker-class=tornado
--timeout=90 --graceful-timeout=30 --log-level=DEBUG --access-logfile - --error-logfile - chiefsend:app
ENTRYPOINT
gunicorn -b :5000 --workers=3 --timeout=90 --graceful-timeout=30 --log-level=DEBUG --access-logfile - --error-logfile - chiefsend:app
app/__init__.py
View file @
d8c863e2
...
...
@@ -4,11 +4,8 @@ from flask_sqlalchemy import SQLAlchemy
from
redis
import
Redis
from
rq
import
Queue
print
(
'WE GOIN IN BOIS'
)
basedir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
))
datadir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
basedir
,
'data'
))
print
(
basedir
)
print
(
datadir
)
app
=
Flask
(
__name__
)
app
.
config
[
'SECRET_KEY'
]
=
os
.
getenv
(
'SECRET_KEY'
)
or
'jonas ist ein kek'
...
...
@@ -16,13 +13,13 @@ app.config['MEDIA_LOCATION'] = os.getenv('MEDIA_LOCATION') or os.path.join(datad
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
os
.
getenv
(
'DATABASE_URI'
)
or
'sqlite:///'
+
os
.
path
.
join
(
datadir
,
'home.db'
)
app
.
config
[
'SQLALCHEMY_TRACK_MODIFICATIONS'
]
=
False
app
.
config
[
'MAX_MEDIA_SIZE'
]
=
1000
*
1024
*
1024
# 1000 MB
app
.
config
[
'REDIS_CONNECTION'
]
=
os
.
getenv
(
'REDIS_URL'
)
or
'redis://'
db
=
SQLAlchemy
(
app
)
#task_queue = Queue(connection=Redis.from_url('redis://chiefsend-redis'))
task_queue
=
Queue
(
connection
=
Redis
())
from
app.models
import
*
task_queue
=
Queue
(
connection
=
Redis
.
from_url
(
app
.
config
[
'REDIS_CONNECTION'
]))
from
app.models
import
*
db
.
create_all
()
db
.
session
.
commit
()
...
...
docker-compose.yml
View file @
d8c863e2
...
...
@@ -20,7 +20,7 @@ services:
-
type
:
volume
source
:
chiefsend-vol
target
:
/home/chiefsend/data
entrypoint
:
rq worker --with-scheduler --url
redis://chiefsend-redis
# connect to redis hostname
entrypoint
:
rq worker --with-scheduler --url
${REDIS_URL}
# connect to redis hostname
web
:
container_name
:
"
chiefsend-web"
...
...
@@ -33,6 +33,5 @@ services:
source
:
chiefsend-vol
target
:
/home/chiefsend/data
volumes
:
chiefsend-vol
:
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment