remotes/1693045480750635534/spooky-22
Aevann1 2021-11-25 23:47:48 +02:00
parent ea88aef3b5
commit 0518bce2e2
10 changed files with 22 additions and 22 deletions

View File

@ -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

4
env
View File

@ -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"

View File

@ -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)

View File

@ -17,7 +17,7 @@
<p>In the <a href="/settings/apps">apps tab of Drama settings</a>, fill in and submit the form to request an access token. You will need:</p>
<ul>
<li>an application name</li>
<li>a Redirect URI. May not use HTTP unless using 127.0.0.1 (use HTTPS instead).</li>
<li>a Redirect URI. May not use HTTP unless using 0.0.0.0 (use HTTPS instead).</li>
<li>a brief description of what your bot is intended to do</li>
</ul>
<p>Don't worry too much about accuracy; you will be able to change all of these later.</p>
@ -54,7 +54,7 @@
<p>In the <a href="/settings/apps">apps tab of Drama settings</a>, fill in and submit the form to request new API keys. You will need:</p>
<ul>
<li>an application name</li>
<li>a Redirect URI. May not use HTTP unless using 127.0.0.1 (use HTTPS instead).</li>
<li>a Redirect URI. May not use HTTP unless using 0.0.0.0 (use HTTPS instead).</li>
<li>a brief description of what your application is intended to do</li>
</ul>
<p>Don't worry too much about accuracy; you will be able to change all of these later.</p>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500

2
setup
View File

@ -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
gunicorn files.__main__:app -k gevent -w 2 --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500

View File

@ -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