Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
# copy api directory to docker's work directory.
COPY . $FUSION_HOME

# Migrate all migrations
# RUN cd FusionIIIT && python manage.py migrate

# port where the Django app runs
EXPOSE 8000

# start server
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
CMD ["/bin/bash","docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion FusionIIIT/Fusion/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fusionlab',
'HOST': 'localhost',
'HOST': os.environ.get("DB_HOST", default='localhost'),
'USER': 'fusion_admin',
'PASSWORD': 'hello123',
}
Expand Down
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,5 @@ The project now supports notifications across all modules. To implement notifica

## Setting up Fusion using Docker
- Make sure you have docker & docker-compose setup properly.
- Update `FusionIIIT/Fusion/settings/development.py`
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'fusiondb',
'HOST': os.environ.get("DB_HOST"),
'USER': 'fusionuser',
'PASSWORD': 'password',
}
}
```
- Run `docker-compose up`
- Once the server starts, run `sudo docker exec -i fusion_db_1 psql -U fusionuser -d fusiondb < path_to_db_dump`
- Once the server starts, run `sudo docker exec -i fusion_db_1 psql -U fusion_admin -d fusionlab < path_to_db_dump`
13 changes: 8 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ version: "3.9"
services:
db:
image: postgres:13-alpine
restart: always
volumes:
- /private/var/lib/postgresql:/var/lib/postgresql
- /private/var/lib/postgresql:/var/lib/postgresql/data
environment:
- POSTGRES_DB=fusiondb
- POSTGRES_USER=fusionuser
- POSTGRES_PASSWORD=password
- PGDATA=/var/lib/postgresql/data/some_name/
- POSTGRES_DB=fusionlab
- POSTGRES_USER=fusion_admin
- POSTGRES_PASSWORD=hello123
ports:
- "5432:5432"
app:
build:
context: .
dockerfile: Dockerfile
restart: always
volumes:
- .:/home/app
ports:
- 8000:8000
command: python FusionIIIT/manage.py runserver 0.0.0.0:8000
command: /bin/bash docker-entrypoint.sh
environment:
- DB_HOST=db
depends_on:
Expand Down
10 changes: 10 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Apply database migrations
# echo "Apply database migrations"
# python FusionIIIT/manage.py makemigrations
# python FusionIIIT/manage.py migrate

# Start server
echo "Starting server"
python FusionIIIT/manage.py runserver 0.0.0.0:8000