-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To make it easier for other users to try hackergame platform. Ref: https://github.com/taoky/container-slides
- Loading branch information
Showing
8 changed files
with
137 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
server { | ||
listen 80; | ||
#server_name hack.lug.ustc.edu.cn; | ||
server_name _; | ||
|
||
charset utf-8; | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
server_tokens off; | ||
log_not_found off; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
access_log /var/log/nginx/hackergame.log; | ||
error_log /var/log/nginx/hackergame.error.log; | ||
|
||
gzip on; | ||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml; | ||
|
||
location /media { | ||
root /var/opt/hackergame; | ||
add_header Content-Type application/octet-stream; | ||
expires -1; | ||
} | ||
location /static { | ||
root /var/opt/hackergame; | ||
expires 1h; | ||
} | ||
location / { | ||
uwsgi_pass hackergame:2018; | ||
client_max_body_size 500M; | ||
include /etc/nginx/uwsgi_params; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
[uwsgi] | ||
socket=unix:///run/uwsgi/app/hackergame-docker/socket | ||
socket=:2018 | ||
chdir=/opt/hackergame | ||
#plugin=python3,gevent_python3 | ||
module=frontend.wsgi:application | ||
env=DJANGO_SETTINGS_MODULE=conf.settings.hackergame | ||
env=PSYCOPG_WAIT_FUNC=wait_selector | ||
master=true | ||
#processes=16 | ||
gevent=1024 | ||
gevent-monkey-patch=true | ||
vacuum=true | ||
home=/usr/local | ||
uid=www-data | ||
gid=www-data | ||
#home=/usr/local | ||
#uid=www-data | ||
#gid=www-data | ||
stats=/run/uwsgi/app/hackergame-docker/stats.socket | ||
harakiri=60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DB_PASSWORD=youshouldmodifythis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh -e | ||
|
||
# Set permission for /run/uwsgi/app/hackergame-docker/ | ||
mkdir -p /run/uwsgi/app/hackergame-docker/ | ||
chown www-data:www-data /run/uwsgi/app/hackergame-docker/ | ||
|
||
echo "Note that /opt/hackergame/ shall be readable by uwsgi (www-data in container)." | ||
echo "You could set it to be readable by everyone: chmod -R a+rX hackergame/" | ||
|
||
echo "If this is your first time to run this container, you should run:" | ||
echo " docker exec -it hackergame ./manage.py migrate" | ||
echo " docker exec -it hackergame ./manage.py collectstatic" | ||
|
||
# Start uwsgi | ||
exec /usr/local/bin/uwsgi --master --ini conf/uwsgi.ini \ | ||
--ini conf/uwsgi-apps/hackergame-docker.ini \ | ||
--set-placeholder appname=hackergame-docker |