Skip to content

Commit 08796bf

Browse files
author
Thoonsen Maxime
authored
update install script and dev environement (#136)
1 parent fb8711e commit 08796bf

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

Makefile

+2-6
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ frontend/start:
3333
.env: .env.example
3434
@if [ -f .env ]; \
3535
then\
36-
echo '\033[1;41m/!\ The .env.example file has changed. Please check your .env file (this message will not be displayed again).\033[0m';\
37-
touch .env;\
38-
exit 1;\
36+
echo '\033[1;41m/!\ You already have created .env file. You should have a look at the .env.example file to ensure you have set all required environment variables for docker-compose.\033[0m';\
3937
else\
4038
echo cp .env.example .env;\
4139
cp .env.example .env;\
@@ -44,9 +42,7 @@ frontend/start:
4442
frontend/.env: frontend/.env.example
4543
@if [ -f frontend/.env ]; \
4644
then\
47-
echo '\033[1;41m/!\ The frontend/.env.example file has changed. Please check your frontend/.env file (this message will not be displayed again).\033[0m';\
48-
touch frontend/.env;\
49-
exit 1;\
45+
echo '\033[1;41m/!\ You already have created a .env file for the frontend. You should have a look at the frontend/.env.example to ensure you have set all required environment variables to make the frontend work (this message will not be displayed again).\033[0m';\
5046
else\
5147
echo cp frontend/.env.example frontend/.env;\
5248
cp frontend/.env.example frontend/.env;\

docker-compose.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ services:
44
db:
55
image: postgres:10
66
ports:
7-
- "5432:5432"
7+
# We changed the default port so people having already a postgres instance running on port 5432 won't have a port conflict
8+
- "5433:5432"
89
volumes:
910
- ./postgres-data:/var/lib/postgresql/data
11+
environment:
12+
- POSTGRES_PASSWORD=password
13+
- POSTGRES_USER=postgres
14+
- POSTGRES_DB=postgres
1015

1116
backend:
1217
build: ./backend
@@ -22,7 +27,7 @@ services:
2227
env_file:
2328
- .env
2429
environment:
25-
DATABASE_URL: "postgres://postgres@db:5432/postgres"
30+
DATABASE_URL: "postgres://postgres:password@db:5432/postgres"
2631

2732
redis:
2833
image: redis
@@ -37,7 +42,7 @@ services:
3742
env_file:
3843
- .env
3944
environment:
40-
DATABASE_URL: "postgres://postgres@db:5432/postgres"
45+
DATABASE_URL: "postgres://postgres:password@db:5432/postgres"
4146
command: celery worker -A root.celery -B -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler -c 4
4247

4348
networks:

hooks/pre-commit

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ else
3434
fi
3535

3636
# Run black and get the output and return code
37-
black=$(black --exclude venv --diff --check backend/.)
37+
black=$(docker-compose exec -T backend black --diff --check .)
3838
ret_code=$?
3939

4040
if [ $ret_code != 0 ]; then
@@ -46,7 +46,7 @@ else
4646
fi
4747

4848
# Run flake8 and get the output and return code
49-
flake=$(flake8 backend/. --exclude backend/venv/)
49+
flake=$(docker-compose exec -T backend flake8 . --exclude ./venv/)
5050
ret_code=$?
5151

5252
if [ $ret_code != 0 ]; then

0 commit comments

Comments
 (0)