More progress to production
This commit is contained in:
parent
8fd90940bc
commit
e582f4f854
9
.env.example
Normal file
9
.env.example
Normal file
@ -0,0 +1,9 @@
|
||||
DEBUG=1
|
||||
SECRET_KEY=password123
|
||||
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1] vf bloons.walter.lol
|
||||
SQL_ENGINE=django.db.backends.postgresql
|
||||
SQL_DATABASE=bloonsworld
|
||||
SQL_USER=bloonsworld
|
||||
SQL_PASSWORD=password123
|
||||
SQL_HOST=db
|
||||
SQL_PORT=5432
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
legacy
|
||||
.idea
|
||||
venv
|
||||
.env
|
||||
*.sqlite3
|
||||
*.db
|
||||
@ -1 +0,0 @@
|
||||
localhost:5432:bloonsworld:password123
|
||||
@ -1,5 +0,0 @@
|
||||
[bloonsworld]
|
||||
host=localhost
|
||||
user=bloonsworld
|
||||
dbname=bloonsworld
|
||||
port=5432
|
||||
17
app/entrypoint.sh
Normal file
17
app/entrypoint.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$DATABASE" = "postgres" ]
|
||||
then
|
||||
echo "Waiting for postgres..."
|
||||
|
||||
while ! nc -z $SQL_HOST $SQL_PORT; do
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
echo "PostgreSQL started"
|
||||
fi
|
||||
|
||||
python manage.py flush --no-input
|
||||
python manage.py migrate
|
||||
|
||||
exec "$@"
|
||||
@ -1,8 +1,9 @@
|
||||
django==5.1.*
|
||||
django-crispy-forms
|
||||
crispy-bootstrap4
|
||||
django-extensions
|
||||
tqdm
|
||||
Pillow
|
||||
django-resized
|
||||
django-cleanup
|
||||
django==5.1.6
|
||||
django-crispy-forms==2.3
|
||||
crispy-bootstrap4==2024.10
|
||||
django-extensions==3.2.3
|
||||
tqdm==4.67.1
|
||||
Pillow==11.1.0
|
||||
django-resized==1.0.3
|
||||
django-cleanup==9.0.0
|
||||
psycopg2-binary==2.9.10
|
||||
@ -23,16 +23,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
DEBUG = bool(os.environ.get("DEBUG", default=1))
|
||||
|
||||
if platform != "win32":
|
||||
with open("/secret", "r") as f:
|
||||
SECRET_KEY = f.read()
|
||||
else:
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-)e!wy4)=xinnd!d(iuw6*-tf^-)ptiwnttwf+9ql%*jy63wtd8'
|
||||
def load_insecure_key():
|
||||
print("Warning: Insecure SECRET_KEY loaded")
|
||||
return 'django-insecure-)e!wy4)=xinnd!d(iuw6*-tf^-)ptiwnttwf+9ql%*jy63wtd8'
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
SECRET_KEY = os.environ.get("SECRET_KEY") or load_insecure_key()
|
||||
|
||||
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ") or "*"
|
||||
|
||||
# Application definition
|
||||
|
||||
@ -94,24 +93,17 @@ WSGI_APPLICATION = 'settings.wsgi.application'
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {}
|
||||
|
||||
if DEBUG:
|
||||
DATABASES["default"] = {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
else:
|
||||
DATABASES["default"] = {
|
||||
"ENGINE": "django.db.backends.postgresql",
|
||||
"OPTIONS": {
|
||||
"service": "bloonsworld_db",
|
||||
"passfile": ".my_pgpass",
|
||||
# "isolation_level": IsolationLevel.SERIALIZABLE,
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
|
||||
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
|
||||
"USER": os.environ.get("SQL_USER", "user"),
|
||||
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
|
||||
"HOST": os.environ.get("SQL_HOST", "localhost"),
|
||||
"PORT": os.environ.get("SQL_PORT", "5432"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
||||
|
||||
|
||||
@ -21,7 +21,11 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
bloonsworld-db:
|
||||
|
||||
image: postgres:17
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data/
|
||||
environment:
|
||||
- "POSTGRES_HOST_AUTH_METHOD=trust"
|
||||
networks:
|
||||
- bloonsworld
|
||||
restart: unless-stopped
|
||||
|
||||
15
readme.md
15
readme.md
@ -1,2 +1,17 @@
|
||||
# Bloonsworld archive
|
||||
yes finally.
|
||||
|
||||
## How do i play?
|
||||
at https://bloons.walter.lol
|
||||
|
||||
## How do i run it on my pc/server?
|
||||
- install docker ([windows](https://docs.docker.com/desktop/setup/install/windows-install/), [linux](https://docs.docker.com/desktop/setup/install/linux/), [mac](https://docs.docker.com/desktop/setup/install/mac-install/))
|
||||
- do `git clone https://git.walter.lol/respect/bloonsworld`
|
||||
- in the downloaded folder, do `docker-compose up -d`
|
||||
|
||||
|
||||
## What do i do once im running it?
|
||||
This will guide you through making an admin account
|
||||
- `docker exec -it bloonsworld /bin/bash`
|
||||
- `cd /app`
|
||||
- `py manage.py createsuperuser`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user