From 35ef1e2fb1223bb6789480dd8660de9e3af7beff Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Thu, 27 Jul 2023 12:12:58 +0545 Subject: [PATCH] Added fix for Docker file to see logs and installation doc --- Readme.md | 3 +-- backend/Dockerfile | 2 +- docker-compose.yml | 20 ++++++++++++-------- docs/Docker-installation.md | 16 +++++++++------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Readme.md b/Readme.md index b47904f7..9a557b1c 100644 --- a/Readme.md +++ b/Readme.md @@ -28,5 +28,4 @@ See below a suggested product roadmap [subject to change] that provides high-lev ## Local Installation [DEV] -Checkout Docker Installation [docs](./docs/Docker-installation.md)## Local Installation [DEV] - +Checkout Docker Installation [docs](./docs/Docker-installation.md) diff --git a/backend/Dockerfile b/backend/Dockerfile index c8f1cbbb..b7e40872 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -28,6 +28,6 @@ RUN pip install setuptools --upgrade COPY requirements.txt requirements.txt RUN pip install -r requirements.txt -RUN mkdir /app + WORKDIR /app COPY . /app \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0080def3..65817a0a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.8' +version: "3.8" services: postgres: @@ -10,8 +10,8 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=admin ports: - - '5434:5432' - + - "5434:5432" + redis: image: redis container_name: redis @@ -20,7 +20,7 @@ services: backend-api: build: - context: ./backend + context: ./backend dockerfile: Dockerfile container_name: api command: python manage.py runserver 0.0.0.0:8000 @@ -33,6 +33,7 @@ services: ports: - 8000:8000 volumes: + - ./backend:/app - ${RAMP_HOME}:/RAMP_HOME - ${TRAINING_WORKSPACE}:/TRAINING_WORKSPACE depends_on: @@ -41,7 +42,7 @@ services: backend-worker: build: - context: ./backend + context: ./backend dockerfile: Dockerfile container_name: worker command: celery -A aiproject worker --loglevel=INFO @@ -52,6 +53,7 @@ services: - driver: nvidia capabilities: [gpu] volumes: + - ./backend:/app - ${RAMP_HOME}:/RAMP_HOME - ${TRAINING_WORKSPACE}:/TRAINING_WORKSPACE depends_on: @@ -72,11 +74,13 @@ services: frontend: build: - context: ./frontend + context: ./frontend dockerfile: Dockerfile.frontend container_name: frontend command: npm start -- --host 0.0.0.0 --port 3000 ports: - - 3000:3000 + - 3000:3000 depends_on: - - backend-api \ No newline at end of file + - backend-api + volumes: + - ./frontend:/app diff --git a/docs/Docker-installation.md b/docs/Docker-installation.md index 239c945f..7fdd8d01 100644 --- a/docs/Docker-installation.md +++ b/docs/Docker-installation.md @@ -56,6 +56,13 @@ Docker Compose is created with redis , worker , postgis database , api and fron ``` eg : export RAMP_HOME=/home/kshitij/ramp + - Export ```TRAINING_WORKSPACE``` Env + Training workspace is the folder where fAIr will store its training files + for eg : + ``` + export TRAINING_WORKSPACE=/home/kshitij/hotosm/fAIr/trainings + ``` + 5. Register your Local setup to OSM - Go to [OpenStreetMap](https://www.openstreetmap.org/) , Login/Create Account @@ -73,12 +80,7 @@ Docker Compose is created with redis , worker , postgis database , api and fron - Fill out the details of ```OSM_CLIENT_ID``` &```OSM_CLIENT_SECRET``` in .env file and generate a unique key & paste it to ```OSM_SECRET_KEY``` (It can be random for dev setup) Leave rest of the items as it is unless you know what you are doing - - Export ```TRAINING_WORKSPACE``` Env - Training workspace is the folder where fAIr will store its training files - for eg : - ``` - export TRAINING_WORKSPACE=/home/kshitij/hotosm/fAIr/trainings - ``` + - Create ```.env``` in /frontend ``` cp .env_sample .env @@ -110,7 +112,7 @@ Docker Compose is created with redis , worker , postgis database , api and fron python manage.py makemigrations python manage.py makemigrations login - python manage.py makemigrations login + python manage.py makemigrations core python manage.py migrate 9. Play and Develop