diff --git a/Makefile b/Makefile index 8c4d251..623227b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ server: backend backend: + @docker-compose up -d @python manage.py runserver frontend: @@ -23,10 +24,12 @@ clean: @find . -type d -name '__pycache__' -delete reset-db: - @sudo -iu postgres bash -c "psql -c 'DROP DATABASE IF EXISTS coobs;'" - @sudo -iu postgres bash -c "psql -c 'CREATE DATABASE coobs;'" - @sudo -iu postgres bash -c "psql -c 'GRANT ALL PRIVILEGES ON DATABASE coobs TO coobs;'" - @sudo -iu postgres bash -c "psql -c 'ALTER USER coobs CREATEDB;'" + @psql -h localhost -U postgres -c "DROP DATABASE IF EXISTS coobs;" + @psql -h localhost -U postgres -c "CREATE DATABASE coobs;" + @psql -h localhost -U postgres -c "DROP ROLE IF EXISTS coobs;" + @psql -h localhost -U postgres -c "CREATE ROLE coobs WITH LOGIN CREATEDB PASSWORD 'coobspass';" + @psql -h localhost -U postgres -c "ALTER DATABASE coobs OWNER TO coobs;" + @psql -h localhost -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE coobs TO coobs;" @echo "\033[0;32mDB reset done! => Running migrations.." @$(MAKE) -s migration @echo "\033[0;32mMigrations done! => Creating superuser.." diff --git a/docker-compose.yml b/docker-compose.yml index 3567bc3..b7fddd3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,41 @@ -# Tools -postgres: - image: postgres - ports: - - "5432:5432" - volumes_from: - - 'data' - environment: - POSTGRES_USER: "postgres" - POSTGRES_PASSWORD: "postgres" - volumes: - - "/tmp:/tmp" +version: "3.8" -data: - image: busybox - volumes: - - ./data:/data \ No newline at end of file +services: + postgres: + container_name: postgres + image: postgres:12.1 + hostname: postgres + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" + volumes: + - 'pg_data:/var/lib/postgresql/data' + networks: + close: + aliases: + - postgres + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4:6.21 + environment: + - PGADMIN_DEFAULT_EMAIL=admin@fiqus.coop + - PGADMIN_DEFAULT_PASSWORD=admin + ports: + - "5050:80" + volumes: + - 'pgadmin_data:/var/lib/pgadmin' + networks: + close: + aliases: + - pgadmin + +networks: + close: + driver: bridge + +volumes: + pg_data: + pgadmin_data: diff --git a/requirements.txt b/requirements.txt index 28a26cb..c033956 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,7 @@ markdownify==0.6.5 MarkupSafe==1.1.1 mccabe==0.6.1 openapi-codec==1.3.2 -Pillow==8.2.0 +Pillow==8.3.2 psycopg2==2.8.6 pycparser==2.20 Pygments==2.8.1 @@ -53,7 +53,7 @@ six==1.15.0 soupsieve==2.2 sqlparse==0.4.1 tinycss2==1.1.0 -typed-ast==1.4.2 +typed-ast==1.5.4 uritemplate==3.0.1 urllib3==1.26.5 webencodings==0.5.1