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
|
legacy
|
||||||
.idea
|
.idea
|
||||||
venv
|
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==5.1.6
|
||||||
django-crispy-forms
|
django-crispy-forms==2.3
|
||||||
crispy-bootstrap4
|
crispy-bootstrap4==2024.10
|
||||||
django-extensions
|
django-extensions==3.2.3
|
||||||
tqdm
|
tqdm==4.67.1
|
||||||
Pillow
|
Pillow==11.1.0
|
||||||
django-resized
|
django-resized==1.0.3
|
||||||
django-cleanup
|
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/
|
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = bool(os.environ.get("DEBUG", default=1))
|
||||||
|
|
||||||
if platform != "win32":
|
def load_insecure_key():
|
||||||
with open("/secret", "r") as f:
|
print("Warning: Insecure SECRET_KEY loaded")
|
||||||
SECRET_KEY = f.read()
|
return 'django-insecure-)e!wy4)=xinnd!d(iuw6*-tf^-)ptiwnttwf+9ql%*jy63wtd8'
|
||||||
else:
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
|
||||||
SECRET_KEY = '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
|
# Application definition
|
||||||
|
|
||||||
@ -94,23 +93,16 @@ WSGI_APPLICATION = 'settings.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {}
|
DATABASES = {
|
||||||
|
"default": {
|
||||||
if DEBUG:
|
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
|
||||||
DATABASES["default"] = {
|
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
"USER": os.environ.get("SQL_USER", "user"),
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
|
||||||
|
"HOST": os.environ.get("SQL_HOST", "localhost"),
|
||||||
|
"PORT": os.environ.get("SQL_PORT", "5432"),
|
||||||
}
|
}
|
||||||
else:
|
}
|
||||||
DATABASES["default"] = {
|
|
||||||
"ENGINE": "django.db.backends.postgresql",
|
|
||||||
"OPTIONS": {
|
|
||||||
"service": "bloonsworld_db",
|
|
||||||
"passfile": ".my_pgpass",
|
|
||||||
# "isolation_level": IsolationLevel.SERIALIZABLE,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
||||||
|
|||||||
@ -21,7 +21,11 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
bloonsworld-db:
|
bloonsworld-db:
|
||||||
|
image: postgres:17
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data/
|
||||||
|
environment:
|
||||||
|
- "POSTGRES_HOST_AUTH_METHOD=trust"
|
||||||
networks:
|
networks:
|
||||||
- bloonsworld
|
- bloonsworld
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
15
readme.md
15
readme.md
@ -1,2 +1,17 @@
|
|||||||
# Bloonsworld archive
|
# Bloonsworld archive
|
||||||
yes finally.
|
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