From 0518bce2e2d56d0a8909aa4a0e4ba11be1fbbd72 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 25 Nov 2021 23:47:48 +0200 Subject: [PATCH] fdsfsd --- docker-compose.yml | 2 +- env | 4 ++-- files/__main__.py | 8 ++++---- files/templates/api.html | 4 ++-- pg_hba.conf | 6 +++--- readme.md | 8 ++++---- redis.conf | 6 +++--- restart | 2 +- setup | 2 +- supervisord.conf | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 38d404a129..009424fa2c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: - DATABASE_URL=postgresql://postgres@postgres:5432 - MASTER_KEY=XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY - REDIS_URL=redis://redis - - DOMAIN=127.0.0.1 + - DOMAIN=0.0.0.0 - SITE_NAME=Drama - GIPHY_KEY=3435tdfsdudebussylmaoxxt43 - FORCE_HTTPS=0 diff --git a/env b/env index 1a44622c51..f897886da9 100644 --- a/env +++ b/env @@ -1,6 +1,6 @@ -export DATABASE_URL="postgresql://postgres@127.0.0.1:5432" +export DATABASE_URL="postgresql://postgres@0.0.0.0:5432" export MASTER_KEY="XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY" -export DOMAIN="127.0.0.1" +export DOMAIN="0.0.0.0" export SITE_NAME="Drama" export GIPHY_KEY="3435tdfsdudebussylmaoxxt43" export FORCE_HTTPS="0" diff --git a/files/__main__.py b/files/__main__.py index 899b23eaad..1b694e42c3 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -42,7 +42,7 @@ app.config["SESSION_REFRESH_EACH_REQUEST"] = True app.config["SLOGAN"] = environ.get("SLOGAN", "").strip() app.config["DEFAULT_COLOR"] = environ.get("DEFAULT_COLOR", "ff0000").strip() app.config["DEFAULT_THEME"] = environ.get("DEFAULT_THEME", "midnight").strip() -app.config["FORCE_HTTPS"] = int(environ.get("FORCE_HTTPS", 1)) if ("127.0.0.1" not in app.config["SERVER_NAME"] and "127.0.0.1" not in app.config["SERVER_NAME"]) else 0 +app.config["FORCE_HTTPS"] = int(environ.get("FORCE_HTTPS", 1)) if ("0.0.0.0" not in app.config["SERVER_NAME"] and "0.0.0.0" not in app.config["SERVER_NAME"]) else 0 app.config["UserAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36" app.config["HCAPTCHA_SITEKEY"] = environ.get("HCAPTCHA_SITEKEY","").strip() app.config["HCAPTCHA_SECRET"] = environ.get("HCAPTCHA_SECRET","").strip() @@ -61,14 +61,14 @@ app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False app.config["RATELIMIT_HEADERS_ENABLED"]=True app.config["CACHE_TYPE"] = "filesystem" app.config["CACHE_DIR"] = "cache" -app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://127.0.0.1") +app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://0.0.0.0") app.config['MAIL_SERVER'] = 'smtp.gmail.com' app.config['MAIL_PORT'] = 587 app.config['MAIL_USE_TLS'] = True app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip() app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip() -r=redis.Redis(host=environ.get("REDIS_URL", "redis://127.0.0.1"), decode_responses=True, ssl_cert_reqs=None) +r=redis.Redis(host=environ.get("REDIS_URL", "redis://0.0.0.0"), decode_responses=True, ssl_cert_reqs=None) limiter = Limiter( app, @@ -103,7 +103,7 @@ def before_request(): session.permanent = True if not session.get("session_id"): session["session_id"] = secrets.token_hex(16) - if app.config["FORCE_HTTPS"] and request.url.startswith("http://") and "127.0.0.1" not in app.config["SERVER_NAME"]: + if app.config["FORCE_HTTPS"] and request.url.startswith("http://") and "0.0.0.0" not in app.config["SERVER_NAME"]: url = request.url.replace("http://", "https://", 1) return redirect(url, code=301) diff --git a/files/templates/api.html b/files/templates/api.html index 91944ff13e..82b2097901 100644 --- a/files/templates/api.html +++ b/files/templates/api.html @@ -17,7 +17,7 @@

In the apps tab of Drama settings, fill in and submit the form to request an access token. You will need:

Don't worry too much about accuracy; you will be able to change all of these later.

@@ -54,7 +54,7 @@

In the apps tab of Drama settings, fill in and submit the form to request new API keys. You will need:

Don't worry too much about accuracy; you will be able to change all of these later.

diff --git a/pg_hba.conf b/pg_hba.conf index e00d09b27f..8a6ac89767 100644 --- a/pg_hba.conf +++ b/pg_hba.conf @@ -34,11 +34,11 @@ local all postgres trust # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: -host all all 127.0.0.1/32 trust +host all all 0.0.0.0/32 trust # IPv6 local connections: host all all ::1/128 trust -# Allow replication connections from 127.0.0.1, by a user with the +# Allow replication connections from 0.0.0.0, by a user with the # replication privilege. local replication all trust -host replication all 127.0.0.1/32 trust +host replication all 0.0.0.0/32 trust host replication all ::1/128 trust \ No newline at end of file diff --git a/readme.md b/readme.md index e763ee9b07..18a3b9bc87 100644 --- a/readme.md +++ b/readme.md @@ -22,9 +22,9 @@ git clone https://github.com/Aevann1/Drama/ docker-compose up ``` -4- That's it! Visit `127.0.0.1` in your browser. +4- That's it! Visit `0.0.0.0` in your browser. -5- Optional: to change the domain from "127.0.0.1" to something else and configure the site settings, as well as integrate it with the external services the website uses, please edit the variables in the docker-compose.yml file and then restart the docker container from inside the docker app. +5- Optional: to change the domain from "0.0.0.0" to something else and configure the site settings, as well as integrate it with the external services the website uses, please edit the variables in the docker-compose.yml file and then restart the docker container from inside the docker app. --- @@ -48,10 +48,10 @@ cd /drama source setup ``` -4- That's it. Visit `127.0.0.1` in your browser. +4- That's it. Visit `0.0.0.0` in your browser. -5- Optional: to change the domain from "127.0.0.1" to something else and configure the site settings, as well as integrate it with the external services the website uses, please run this command and edit the variables: +5- Optional: to change the domain from "0.0.0.0" to something else and configure the site settings, as well as integrate it with the external services the website uses, please run this command and edit the variables: ``` nano /env diff --git a/redis.conf b/redis.conf index 4220f5424a..2688151330 100644 --- a/redis.conf +++ b/redis.conf @@ -53,7 +53,7 @@ # Examples: # # bind 192.168.1.100 10.0.0.1 -# bind 127.0.0.1 ::1 +# bind 0.0.0.0 ::1 # # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the # internet, binding to all the interfaces is dangerous and will expose the @@ -66,7 +66,7 @@ # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT THE FOLLOWING LINE. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bind 127.0.0.1 ::1 +bind 0.0.0.0 ::1 # Protected mode is a layer of security protection, in order to avoid that # Redis instances left open on the internet are accessed and exploited. @@ -78,7 +78,7 @@ bind 127.0.0.1 ::1 # 2) No password is configured. # # The server only accepts connections from clients connecting from the -# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain +# IPv4 and IPv6 loopback addresses 0.0.0.0 and ::1, and from Unix domain # sockets. # # By default protected mode is enabled. You should disable it only if diff --git a/restart b/restart index d5f207d402..992cf15888 100644 --- a/restart +++ b/restart @@ -1,3 +1,3 @@ source /env killall gunicorn -gunicorn files.__main__:app -k gevent -w 2 --reload -b 127.0.0.1:80 --max-requests 1000 --max-requests-jitter 500 \ No newline at end of file +gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500 \ No newline at end of file diff --git a/setup b/setup index cab6fd711a..879e5562d9 100644 --- a/setup +++ b/setup @@ -15,4 +15,4 @@ mkdir /songs mkdir /images cp ./env /env . /env -gunicorn files.__main__:app -k gevent -w 2 --reload -b 127.0.0.1:80 --max-requests 1000 --max-requests-jitter 500 \ No newline at end of file +gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500 \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf index 84f49b3cd2..812f638211 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -5,7 +5,7 @@ logfile=/tmp/supervisord.log [program:service] directory=/service -command=gunicorn files.__main__:app -k gevent -w 2 --reload -b 127.0.0.1:80 --max-requests 1000 --max-requests-jitter 500 +command=gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500 stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr