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
98427af2
Commit
98427af2
authored
Dec 20, 2020
by
Lukas Böhm
🎱
Browse files
think it works now maybe lul
parent
7f199ebf
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/__init__.py
View file @
98427af2
...
...
@@ -13,13 +13,12 @@ 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_CONTENT_LENGTH'
]
=
5
*
1024
*
1024
# 5 MB
app
.
config
[
'REDIS_URI'
]
=
os
.
getenv
(
'REDIS_UR
L
'
)
or
'redis://'
app
.
config
[
'REDIS_URI'
]
=
os
.
getenv
(
'REDIS_UR
I
'
)
or
'redis://'
db
=
SQLAlchemy
(
app
)
# task_queue = Queue(connection=Redis.from_url(app.config['REDIS_URI']))
# task_queue = Queue(connection=Redis(host='redis'))
task_queue
=
Queue
(
connection
=
Redis
(
host
=
'localhost'
))
task_queue
=
Queue
(
connection
=
Redis
(
host
=
'chiefsend-redis'
))
from
app.models
import
*
...
...
app/routes.py
View file @
98427af2
import
os
from
datetime
import
timedelta
from
werkzeug.exceptions
import
HTTPException
from
app
import
app
,
db
from
flask
import
redirect
,
url_for
,
render_template
,
send_from_directory
,
current_app
,
abort
,
request
from
flask
import
redirect
,
url_for
,
render_template
,
send_from_directory
,
current_app
,
abort
,
request
,
jsonify
from
app.models
import
Share
,
Attachment
from
app.forms
import
UploadForm
from
app
import
task_queue
as
que
from
shutil
import
make_archive
,
rmtree
@
app
.
route
(
'/config'
)
def
see_config
():
return
jsonify
(
dict
(
redis
=
app
.
config
[
'REDIS_URI'
]))
def
get_and_check_share
(
share_id
):
share
=
Share
.
query
.
get
(
share_id
)
if
share
is
None
:
...
...
docker-compose.yml
View file @
98427af2
...
...
@@ -2,27 +2,29 @@ version: "3.8"
services
:
redis
:
container_name
:
"
redis"
hostname
:
"
redis"
container_name
:
"
chiefsend-
redis"
hostname
:
"
chiefsend-
redis"
image
:
"
redis:latest"
# ports:
# - "5000:6379"
#command: [ "redis-server", "--appendonly", "yes" ]
rq
:
container_name
:
"
chiefsend-rq"
image
:
"
geekinutah/python-rq-worker"
container_name
:
"
chiefsend-tasks"
image
:
"
chiefsend:latest"
entrypoint
:
rq worker --with-scheduler --url redis://chiefsend-redis
environment
:
-
REDIS_HOST=redis
links
:
-
redis:redis
-
redis
-
REDIS_URI=redis:///chiefsend-redis
depends_on
:
-
redis
volumes
:
-
type
:
bind
source
:
./data
target
:
/home/chiefsend/data
web
:
container_name
:
"
chiefsend-web"
build
:
.
image
:
"
chiefsend:latest"
environment
:
-
REDIS_URI=redis:///chiefsend-redis
deploy
:
resources
:
limits
:
...
...
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