Skip to content

Commit

Permalink
Merge pull request #30 from munshkr/revert-postgres
Browse files Browse the repository at this point in the history
Revert postgres migration back to sqlite3
  • Loading branch information
munshkr authored Feb 4, 2024
2 parents 877d242 + f03a28a commit dbe7c3b
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 60 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@ jobs:
runs-on: ubuntu-latest
container: python:3.7

# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install Dependencies
Expand All @@ -37,8 +20,3 @@ jobs:
- name: Run Tests
run: |
python manage.py test
env:
PGHOST: postgres
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Copy `env.sample` to `.env` and update if necessary. You should set at least:
- `CORS_ALLOWED_ORIGINS`: Add your request origin.
- `LANGUAGE_CODE`: Set default language code.
- `TIME_ZONE`: Set server time zone if different than UTC.
- `PG*`: Set to corresponding Postgres database server
- `DB_PATH`: Set path where to save database file

Now, run migrations to create and prepare database:

Expand Down
23 changes: 0 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
version: "3.7"

services:
db:
image: postgres
env_file:
- .env
environment:
- POSTGRES_DB=muxy
- POSTGRES_USER=muxy
- POSTGRES_PASSWORD=muxy
ports:
- 5432:5432
volumes:
- pgdata:/var/lib/postgresql/data

muxy:
build: .
command: gunicorn muxy.wsgi:application --workers 3 --bind 0.0.0.0:8000
image: muxy:latest
env_file:
- .env
environment:
- PGHOST=db
- PGDATABASE=muxy
- PGUSER=muxy
- PGPASSWORD=muxy
volumes:
- .:/usr/src/app
stdin_open: true
tty: true
ports:
- 8000:8000
depends_on:
- db

nginx-rtmp:
build: ./docker/nginx-rtmp/
Expand All @@ -41,6 +21,3 @@ services:
- 8080:8080
depends_on:
- muxy

volumes:
pgdata:
8 changes: 1 addition & 7 deletions env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8080
LANGUAGE_CODE=en-us
TIME_ZONE=UTC

PGDATABASE=muxy
PGUSER=muxy
PGPASSWORD=insert_password
PGHOST=localhost
PGPORT=5432

DB_PATH=~/muxy.sqlite3
DB_PATH=./muxy.db

NGINX_RTMP_UPDATE_TIMEOUT=30

Expand Down
9 changes: 3 additions & 6 deletions muxy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,9 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": os.getenv("PGDATABASE"),
"USER": os.getenv("PGUSER"),
"PASSWORD": os.getenv("PGPASSWORD"),
"HOST": os.getenv("PGHOST"),
"PORT": os.getenv("PGPORT"),
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.getenv("DB_PATH", BASE_DIR / "db.sqlite3"),
"OPTIONS": {"timeout": 20},
}
}

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ djangorestframework-api-key==2.0.0
djangorestframework==3.12.2
drf-spectacular==0.21.0
gunicorn==20.0.4
psycopg2-binary==2.9.9
python-dotenv==0.15.0

0 comments on commit dbe7c3b

Please sign in to comment.