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