Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerize GenCyberCoin, include redis but comment it out if needed
- Loading branch information
1 parent
cf12d63
commit 0d31340
Showing
9 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# bring the stuff down just in case if it has not been down yet | ||
docker-compose down | ||
|
||
echo Building and running the containers... | ||
docker-compose up -d --build | ||
|
||
echo Waiting for 15 sec for postgres database to start up... | ||
docker-compose exec postgres sleep 15 | ||
|
||
echo Creating postgres user... | ||
docker-compose exec postgres psql -U postgres -c "CREATE USER coin_admin PASSWORD 'go-figure-me-cow'" | ||
echo If you see an ERROR here, no big deal | ||
|
||
echo Creating postgres DB... | ||
docker-compose exec postgres psql -U postgres -c "CREATE DATABASE coin_db OWNER coin_admin" | ||
echo If you see an ERROR here, no big deal | ||
|
||
echo Making migrations... | ||
docker-compose exec web python manage.py makemigrations --noinput | ||
|
||
echo Migrating to the database... | ||
docker-compose exec web python manage.py migrate --noinput | ||
|
||
echo Setting up defaults... | ||
docker-compose exec web python manage.py setdefaults | ||
|
||
echo Collecting static files like Javascript, CSS, background image, etc... | ||
docker-compose exec web python manage.py collectstatic --noinput | ||
|
||
echo Done! The server should be running on your IP address, port 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM python:3.7-slim | ||
|
||
WORKDIR /code | ||
|
||
RUN python -m pip install --upgrade pip | ||
|
||
COPY . /code/ | ||
|
||
RUN python -m pip install -r /code/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
restart: always | ||
build: ./cryptocoin | ||
expose: | ||
- "8000" | ||
links: | ||
- postgres:postgres | ||
# - redis:redis | ||
volumes: | ||
- web-django:/code | ||
- web-static:/code/cryptocoin/static | ||
- web-media:/code/cryptocoin/media | ||
# env_file: .env | ||
environment: | ||
- DEBUG='True' | ||
- RUN_IN_DOCKER='True' | ||
command: /usr/local/bin/gunicorn cryptocoin.wsgi:application -w 2 -b :8000 | ||
|
||
nginx: | ||
restart: always | ||
build: ./nginx/ | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- web-static:/code/cryptocoin/static | ||
- web-media:/code/cryptocoin/media | ||
links: | ||
- web:web | ||
|
||
postgres: | ||
restart: always | ||
image: postgres:latest | ||
# ports: | ||
# - "5432:5432" | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data/ | ||
|
||
# redis: | ||
# restart: always | ||
# image: redis:latest | ||
# ports: | ||
# - "6379:6379" | ||
# volumes: | ||
# - redisdata:/data | ||
|
||
volumes: | ||
web-django: | ||
web-static: | ||
web-media: | ||
pgdata: | ||
# redisdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM tutum/nginx | ||
|
||
RUN rm /etc/nginx/sites-enabled/default | ||
|
||
COPY sites-enabled/ /etc/nginx/sites-enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
server { | ||
|
||
listen 80; | ||
server_name localhost; | ||
charset utf-8; | ||
|
||
location /static/ { | ||
alias /code/cryptocoin/static/; | ||
} | ||
|
||
location /media/ { | ||
alias /code/cryptocoin/media/; | ||
} | ||
|
||
location / { | ||
proxy_pass http://web:8000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
|
||
} |