forked from MarseyWorld/MarseyWorld
add nginx to docker
parent
08d6a9c901
commit
bf9a2398da
10
Dockerfile
10
Dockerfile
|
@ -10,8 +10,7 @@ RUN apt install -y ffmpeg
|
|||
RUN apt install -y imagemagick
|
||||
RUN apt install -y postgresql
|
||||
RUN apt install -y libpq-dev
|
||||
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
RUN apt install -y nano
|
||||
|
||||
COPY requirements.txt /etc/requirements.txt
|
||||
|
||||
|
@ -39,6 +38,11 @@ RUN node --version
|
|||
RUN npm --version
|
||||
RUN npm i -g yarn
|
||||
|
||||
RUN apt install -y nginx
|
||||
RUN rm /etc/nginx/sites-available -r
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
RUN mkdir /etc/nginx/includes
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
CMD [ "/usr/bin/supervisord", "-c", "/etc/supervisord.conf" ]
|
||||
CMD [ "/usr/bin/supervisord", "-c", "/rDrama/supervisord.conf" ]
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
version: '2.3'
|
||||
|
||||
services:
|
||||
files:
|
||||
container_name: "rDrama"
|
||||
build:
|
||||
context: .
|
||||
volumes:
|
||||
- "./:/service"
|
||||
- "./:/rDrama"
|
||||
- "./nginx.conf:/etc/nginx/sites-enabled/1"
|
||||
- "./nginx-serve-static.conf:/etc/nginx/includes/serve-static"
|
||||
env_file: env
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://postgres@postgres:5432
|
||||
|
@ -26,9 +26,8 @@ services:
|
|||
- "6379:6379"
|
||||
|
||||
postgres:
|
||||
image: postgres:12.3
|
||||
image: postgres
|
||||
command: ["postgres", "-c", "log_statement=all"]
|
||||
# uncomment this if u wanna output all SQL queries to the console
|
||||
volumes:
|
||||
- "./schema.sql:/docker-entrypoint-initdb.d/00-schema.sql"
|
||||
- "./seed-db.sql:/docker-entrypoint-initdb.d/10-seed-db.sql"
|
||||
|
|
2
env
2
env
|
@ -1,4 +1,4 @@
|
|||
FLASK_APP=/service/files/cli:app
|
||||
FLASK_APP=/rDrama/files/cli:app
|
||||
MASTER_KEY=blahblahblah
|
||||
DOMAIN=localhost
|
||||
SITE_NAME=rDrama
|
||||
|
|
|
@ -129,10 +129,7 @@ def teardown_request(error):
|
|||
del g.db
|
||||
stdout.flush()
|
||||
|
||||
if app.config["SERVER_NAME"] == 'localhost':
|
||||
from files.routes import *
|
||||
from files.routes.chat import *
|
||||
elif "load_chat" in argv:
|
||||
if "load_chat" in argv:
|
||||
from files.routes.chat import *
|
||||
else:
|
||||
from files.routes import *
|
||||
|
|
|
@ -284,7 +284,7 @@ def sign_up_post(v):
|
|||
return signup_error("There was a problem. Please try again.")
|
||||
|
||||
if not hmac.compare_digest(correct_formkey, form_formkey):
|
||||
return signup_error("There was a problem. Please try again.")
|
||||
return signup_error("There was a problem. Please try again!")
|
||||
|
||||
if not request.values.get(
|
||||
"password") == request.values.get("password_confirm"):
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
server {
|
||||
server_name rdrama.net;
|
||||
client_max_body_size 100m;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
ssl_certificate '/rdrama.pem';
|
||||
ssl_certificate_key '/rdrama.key';
|
||||
proxy_set_header Host $host;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:5000/;
|
||||
}
|
||||
location /socket.io {
|
||||
include proxy_params;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
|
@ -0,0 +1,7 @@
|
|||
/etc/init.d/nginx start
|
||||
cd ./chat
|
||||
yarn install
|
||||
yarn chat
|
||||
cd ..
|
||||
gunicorn files.__main__:app load_chat -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:5001 --max-requests 30000 --max-requests-jitter 30000 -D
|
||||
gunicorn files.__main__:app -k gevent -w 1 --reload -b 0.0.0.0:5000 --max-requests 30000 --max-requests-jitter 10000
|
|
@ -3,9 +3,9 @@ nodaemon=true
|
|||
pidfile=/tmp/supervisord.pid
|
||||
logfile=/tmp/supervisord.log
|
||||
|
||||
[program:service]
|
||||
directory=/service
|
||||
command=gunicorn files.__main__:app -k gevent -w 1 --reload -b 0.0.0.0:80 --max-requests 30000 --max-requests-jitter 10000
|
||||
[program:rDrama]
|
||||
directory=/rDrama
|
||||
command=sh startup_docker.sh
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# reboot
|
||||
apt -y update
|
||||
apt -y upgrade
|
||||
apt -y install git redis-server python3-pip ffmpeg imagemagick tmux nginx snapd ufw gpg-agent htop
|
||||
apt -y install git redis-server python3-pip ffmpeg imagemagick tmux nginx snapd ufw gpg-agent htop nano
|
||||
|
||||
git config --global credential.helper store
|
||||
cd /rDrama
|
||||
|
@ -29,8 +29,9 @@ chown postgres:postgres /etc/postgresql/14/main/pg_hba.conf
|
|||
sudo rm /etc/nginx/sites-available -r
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
sudo mkdir /etc/nginx/includes
|
||||
sudo cp nginx.txt /etc/nginx/sites-enabled/1
|
||||
sudo cp nginx-serve-static.txt /etc/nginx/includes/serve-static
|
||||
sudo cp nginx.conf /etc/nginx/sites-enabled/1
|
||||
sudo cp nginx-serve-static.conf /etc/nginx/includes/serve-static
|
||||
/etc/init.d/nginx reload
|
||||
|
||||
psql -U postgres -f schema.sql postgres
|
||||
psql -U postgres -f seed-db.sql postgres
|
||||
|
|
Loading…
Reference in New Issue