functioning container build
This commit is contained in:
27
config/root/docs/index.html
Normal file
27
config/root/docs/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>Something has gone very wrong</title>
|
||||
<style>
|
||||
body {
|
||||
max-width: 600px;
|
||||
padding: 10px 20px 20px 20px;
|
||||
font-family: Sans-Serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Something has gone very wrong</h1>
|
||||
</header>
|
||||
<main>
|
||||
<p>
|
||||
If you can see this message then the front end web server has not forwarded the
|
||||
connection on to the TubeSync back end server. This probably means something has
|
||||
gone wrong with the container build or a process has crashed. Try restarting it.
|
||||
</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
22
config/root/etc/cont-init.d/10-tubesync
Normal file
22
config/root/etc/cont-init.d/10-tubesync
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# Change runtime user UID and GID
|
||||
PUID=${PUID:-911}
|
||||
PGID=${PGID:-911}
|
||||
groupmod -o -g "$PGID" app
|
||||
usermod -o -u "$PUID" app
|
||||
|
||||
# Reset permissions
|
||||
chown -R app:app /run/app && \
|
||||
chmod -R 0700 /run/app && \
|
||||
chown -R app:app /config && \
|
||||
chmod -R 0755 /config && \
|
||||
chown -R app:app /downloads && \
|
||||
chmod -R 0755 /downloads && \
|
||||
chown -R root:app /app && \
|
||||
chmod -R 0750 /app && \
|
||||
find /app -type f -exec chmod 640 {} \; && \
|
||||
|
||||
# Run migrations
|
||||
exec s6-setuidgid app \
|
||||
/usr/bin/python3 /app/manage.py migrate
|
||||
85
config/root/etc/nginx/nginx.conf
Normal file
85
config/root/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,85 @@
|
||||
daemon off;
|
||||
|
||||
user app;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
# Basic settings
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 300;
|
||||
types_hash_max_size 2048;
|
||||
server_tokens off;
|
||||
server_names_hash_bucket_size 64;
|
||||
server_name_in_redirect off;
|
||||
client_body_in_file_only clean;
|
||||
client_body_buffer_size 32K;
|
||||
client_max_body_size 100M;
|
||||
send_timeout 300s;
|
||||
large_client_header_buffers 4 8k;
|
||||
|
||||
# Mime type handling
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Default security headers
|
||||
add_header X-Frame-Options SAMEORIGIN;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
|
||||
# Logging
|
||||
log_format host '$remote_addr - $remote_user [$time_local] "[$host] $request" $status $bytes_sent "$http_referer" "$http_user_agent" "$gzip_ratio"';
|
||||
access_log /dev/stdout;
|
||||
error_log stderr;
|
||||
|
||||
# GZIP
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
# Site
|
||||
server {
|
||||
|
||||
# Ports
|
||||
listen 4848;
|
||||
listen [::]:4848;
|
||||
|
||||
# Web root
|
||||
root /docs;
|
||||
index index.html;
|
||||
|
||||
# Proxy
|
||||
proxy_buffers 32 4k;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
# Server domain name
|
||||
server_name _;
|
||||
|
||||
# Authentication and proxying
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_redirect off;
|
||||
proxy_read_timeout 59;
|
||||
proxy_connect_timeout 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
9
config/root/etc/services.d/gunicorn/run
Executable file
9
config/root/etc/services.d/gunicorn/run
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
UMASK_SET=${UMASK_SET:-022}
|
||||
umask "$UMASK_SET"
|
||||
|
||||
cd /app || exit
|
||||
|
||||
exec s6-setuidgid app \
|
||||
/usr/local/bin/gunicorn -c /app/tubesync/gunicorn.py --capture-output tubesync.wsgi:application
|
||||
5
config/root/etc/services.d/nginx/run
Executable file
5
config/root/etc/services.d/nginx/run
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
cd /
|
||||
|
||||
/usr/sbin/nginx
|
||||
4
config/root/etc/services.d/tubesync-worker/run
Executable file
4
config/root/etc/services.d/tubesync-worker/run
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
exec s6-setuidgid app \
|
||||
/usr/bin/python3 /app/manage.py process_tasks
|
||||
Reference in New Issue
Block a user