-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added configuration to deploy using docker * Fixed docker production file * Fixed docker production file * Fixed docker production file * Fixed docker production file * Updated dockerfile * Updated dockerfile * Updated dockerfile * Fixed nginx config * Fixed nginx config * Fixed nginx config * Updated nginx dockerfile * Updated nginx dockerfile * Updated nginx dockerfile * Added env keys * Updated settings * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated settings * Updated settings * Updated dockerfile * Updated dockerfile * Updated dockerfile * Updated settings * Updated settings * Updated settings * Updated settings * Updated settings * Updated settings * Dockerfile updated * Dockerfile updated for production * Dockerfile updated for production * Dockerfile updated for production * Fixed Dockerfile env variable
- Loading branch information
1 parent
5c8ee27
commit 0eab365
Showing
14 changed files
with
195 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
# Third-party login keys | ||
SOCIAL_AUTH_GITHUB_KEY=githubt-key | ||
SOCIAL_AUTH_GITHUB_KEY=github-key | ||
SOCIAL_AUTH_GITHUB_SECRET=github-secret | ||
|
||
SOCIAL_AUTH_FACEBOOK_KEY=key | ||
SOCIAL_AUTH_FACEBOOK_SECRET=secret | ||
|
||
SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY=key | ||
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET=secret | ||
|
||
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=key | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=secret | ||
|
||
RECAPTCHA_PUBLIC_KEY=key | ||
RECAPTCHA_PRIVATE_KEY=secret | ||
|
||
# To enable prometheus monitoring | ||
ENABLE_PROMETHEUS=1 | ||
ENABLE_PROMETHEUS=0 | ||
|
||
DEBUG=False |
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 |
---|---|---|
@@ -1,17 +1,26 @@ | ||
FROM python:3.8-buster | ||
|
||
WORKDIR /app | ||
WORKDIR /usr/src/app | ||
|
||
COPY requirements.txt /app/ | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
COPY requirements.txt /usr/src/app | ||
|
||
RUN python -m pip install --upgrade pip | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . /app/ | ||
COPY . /usr/src/app | ||
|
||
RUN cp .env.dev.sample .env | ||
|
||
EXPOSE 8000 | ||
#EXPOSE 8000 | ||
|
||
RUN chmod +x entrypoint.sh | ||
|
||
CMD ["sh", "entrypoint.sh"] | ||
ENV APP_HOME=/usr/src/app | ||
ENV DEBUG=1 | ||
RUN mkdir $APP_HOME/staticfiles | ||
RUN mkdir $APP_HOME/mediafiles | ||
|
||
CMD ["sh", "entrypoint.sh"] |
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,36 @@ | ||
FROM python:3.8-buster | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
COPY requirements.txt /usr/src/app | ||
|
||
RUN python -m pip install --upgrade pip | ||
RUN pip install -r requirements.txt | ||
|
||
COPY . /usr/src/app | ||
|
||
RUN cp .env.dev.sample .env | ||
|
||
RUN apt-get update | ||
RUN apt-get -y install nano | ||
|
||
#EXPOSE 8000 | ||
|
||
RUN chmod +x entrypoint.prod.sh | ||
|
||
ENV APP_HOME=/usr/src/app | ||
RUN mkdir $APP_HOME/staticfiles | ||
RUN mkdir $APP_HOME/mediafiles | ||
|
||
RUN mkdir -p staticfiles | ||
RUN mkdir -p mediafiles | ||
|
||
RUN echo "Running from production dockerfile" | ||
|
||
# Collect static files | ||
RUN python manage.py collectstatic --noinput | ||
|
||
CMD ["sh", "entrypoint.prod.sh"] |
File renamed without changes.
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,11 @@ | ||
#FROM tutum/nginx | ||
##FROM nginx:1.21-alpine | ||
# | ||
#RUN rm /etc/nginx/sites-enabled/default || true | ||
# | ||
#COPY sites-enabled/ /etc/nginx/sites-enabled | ||
|
||
FROM nginx:1.21-alpine | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf || true | ||
COPY nginx.conf /etc/nginx/conf.d |
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,43 @@ | ||
# server { | ||
# | ||
# listen 80 default_server; | ||
# server_name default_server; | ||
# charset utf-8; | ||
# | ||
# location /static { | ||
# alias /usr/src/app/jobs/staticfiles; | ||
# } | ||
# | ||
# 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; | ||
# } | ||
# | ||
# } | ||
|
||
upstream hello_django { | ||
server web:8000; | ||
} | ||
|
||
server { | ||
|
||
listen 80; | ||
|
||
location / { | ||
proxy_pass http://web:8000; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_redirect off; | ||
} | ||
|
||
location /static/ { | ||
alias /usr/src/app/staticfiles/; | ||
} | ||
|
||
location /media/ { | ||
alias /usr/src/app/mediafiles/; | ||
} | ||
|
||
} |
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,17 @@ | ||
server { | ||
|
||
listen 80; | ||
charset utf-8; | ||
|
||
location /static { | ||
alias /usr/src/app/jobs/static; | ||
} | ||
|
||
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; | ||
} | ||
|
||
} |
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,30 @@ | ||
version: '3' | ||
|
||
services: | ||
web: | ||
restart: always | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.prod | ||
expose: | ||
- "8000" | ||
volumes: | ||
- static_volume:/usr/src/app/staticfiles | ||
- media_volume:/usr/src/app/mediafiles | ||
# env_file: .env | ||
command: gunicorn jobs.wsgi:application --bind 0.0.0.0:8000 | ||
|
||
nginx: | ||
restart: always | ||
build: ./deployment/nginx/ | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- static_volume:/usr/src/app/staticfiles | ||
- media_volume:/usr/src/app/mediafiles | ||
depends_on: | ||
- web | ||
|
||
volumes: | ||
static_volume: | ||
media_volume: |
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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
version: '3' | ||
|
||
services: | ||
portal: | ||
web: | ||
restart: always | ||
build: . | ||
command: ./entrypoint.sh | ||
volumes: | ||
- .:/app | ||
- .db_data/db.sqlite3:/db.sqlite3 | ||
- static_volume:/usr/src/app/jobs/staticfiles | ||
ports: | ||
- "8000:8000" | ||
- "8000:8000" | ||
|
||
volumes: | ||
static_volume: |
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 @@ | ||
#!/bin/bash | ||
|
||
#/usr/local/bin/gunicorn jobs.wsgi:application -w 2 -b :8000 | ||
|
||
#gunicorn jobs.wsgi:application --bind 0.0.0.0:8000 |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
|
||
python manage.py migrate | ||
python manage.py runserver 0.0.0.0:8000 | ||
python manage.py runserver 0.0.0.0:8000 | ||
#/usr/local/bin/gunicorn jobs.wsgi:application -w 2 -b :8000 |
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