diff --git a/.gitignore b/.gitignore index 1fb6b34..d587634 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ venv/ __azurite* ./digger cloud -.env -.docker-compose-env +*.env +*.env.* + diff --git a/README.md b/README.md index df25fbc..aeca8a8 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ The repository for digger official API. # How to run for development -``` -# run the database -docker-compse up -# create .env file with creds -echo "DATABASE_URL=postgres://postgres:23q4RSDFSDFS@127.0.0.1:5432/postgres" >> .env -make start -``` +1. Create the environment files for local development: + 2. `echo "DATABASE_URL=postgres://postgres:23q4RSDFSDFS@127.0.0.1:5432/postgres" > .env` + 3. `echo "DATABASE_URL=postgres://postgres:23q4RSDFSDFS@postgres:5432/postgres" > .env.docker-compose` +2. Start the Docker containers for the database and the API via `docker-compose up` or `docker-compose up -d` which should make it available from http://localhost:3100 +3. You can also run the API by typing `make start` which should make it available from http://localhost:3000 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 905da19..8328d9d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,5 @@ version: '3.7' - services: postgres: image: postgres:alpine @@ -8,15 +7,20 @@ services: - "5432:5432" environment: - POSTGRES_PASSWORD=23q4RSDFSDFS + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 5s + timeout: 5s + retries: 5 web: - depends_on: + links: - postgres - build: - context: . - dockerfile: Dockerfile + depends_on: + postgres: + condition: service_healthy + build: ./ env_file: - - .docker-compose-env - restart: always + - .env.docker-compose ports: - - "3000:3000" \ No newline at end of file + - "3100:3000"