-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hackademymx/fix-heroku
Added Heroku deploy files and improved boilerplate config
- Loading branch information
Showing
15 changed files
with
215 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
**/__pycache__ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
README.md | ||
**/.vagrant | ||
Vagrantfile | ||
Procfile |
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,20 +1,21 @@ | ||
ENV="dev" | ||
|
||
DJANGO_SECRET_KEY="l%+z&)&7i8casdfjrfnuqkwc*ja!^sdfb2-m1l^3(y78+^+@5@q^!9eq1fg" | ||
DJANGO_ALLOWED_HOSTS="*" | ||
CORS_ALLOW_ALL_ORIGINS="" | ||
CORS_ALLOWED_ORIGINS="" | ||
CSRF_TRUSTED_ORIGINS="" | ||
DJANGO_ALLOWED_HOSTS='*' | ||
CORS_ALLOW_ALL_ORIGINS=True | ||
CORS_ALLOWED_ORIGINS= | ||
CSRF_TRUSTED_ORIGINS= | ||
CSRF_COOKIE_SECURE=True | ||
DEBUG=True | ||
|
||
|
||
# DB variables | ||
POSTGRES_DB="testing" | ||
POSTGRES_USER="test" | ||
POSTGRES_PASSWORD="test" | ||
POSTGRES_HOST="localhost" | ||
# DB variables para base de datos local | ||
POSTGRES_DB=testing | ||
POSTGRES_USER=test | ||
POSTGRES_PASSWORD=test | ||
POSTGRES_HOST=localhost | ||
POSTGRES_PORT=5432 | ||
|
||
USE_DATABASE_URL=True | ||
# DATABASE_URL format | ||
# <database_type>://<username>:<password>@<hostname>:<database_port>/<database_name> | ||
|
||
DATABASE_URL="" | ||
DATABASE_URL=<database_type>://<username>:<password>@<hostname>:<database_port>/<database_name> |
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 |
---|---|---|
|
@@ -139,3 +139,4 @@ cython_debug/ | |
|
||
staticfiles/ | ||
.vscode | ||
.vagrant/* |
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,67 @@ | ||
# For more information, please refer to https://aka.ms/vscode-docker-python | ||
FROM python:3.8.12-bullseye as base | ||
|
||
FROM base as builder | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
libpq-dev \ | ||
shared-mime-info \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir /install | ||
WORKDIR /install | ||
|
||
COPY requirements.txt /requirements.txt | ||
|
||
RUN pip install --prefix=/install -r /requirements.txt | ||
|
||
FROM python:3.8.12-slim-bullseye | ||
|
||
EXPOSE 8000 | ||
|
||
# Keeps Python from generating .pyc files in the container | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Turns off buffering for easier container logging | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
locales \ | ||
tzdata \ | ||
libpq-dev \ | ||
&& echo "America/Mazatlan" > /etc/timezone \ | ||
&& dpkg-reconfigure tzdata \ | ||
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ | ||
&& echo 'LANG="en_US.UTF-8"'>/etc/default/locale \ | ||
&& dpkg-reconfigure --frontend=noninteractive locales \ | ||
&& update-locale LANG=en_US.UTF-8 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /install /usr/local | ||
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
|
||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder | ||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers | ||
RUN groupadd -g 1000 appuser \ | ||
&& useradd --no-log-init --shell /bin/bash -u 1000 -g 1000 -o -c "" -m appuser \ | ||
&& cp -r /etc/skel/. /home/appuser \ | ||
&& chown -R 1000:1000 /home/appuser | ||
|
||
USER appuser | ||
|
||
COPY --chown=appuser:appuser . /home/appuser/app | ||
|
||
WORKDIR /home/appuser/app/api | ||
|
||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] | ||
|
||
#CMD gunicorn --bind 0.0.0.0:$PORT core.wsgi --error-logfile - --access-logfile - --workers 4 | ||
CMD gunicorn --bind 0.0.0.0:$PORT core.wsgi |
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,24 @@ | ||
# For more information, please refer to https://aka.ms/vscode-docker-python | ||
FROM python:3.8.12-bullseye | ||
|
||
EXPOSE 8000 | ||
|
||
# Keeps Python from generating .pyc files in the container | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Turns off buffering for easier container logging | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder | ||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers | ||
RUN groupadd -g 1000 appuser \ | ||
&& useradd --no-log-init --shell /bin/bash -u 1000 -g 1000 -o -c "" -m appuser \ | ||
&& cp -r /etc/skel/. /home/appuser \ | ||
&& chown -R 1000:1000 /home/appuser | ||
|
||
USER appuser | ||
|
||
WORKDIR /home/appuser | ||
|
||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug | ||
CMD ["python", "manage.py", "runserver", "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
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,5 +1 @@ | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = ['*'] | ||
|
||
CORS_ALLOW_ALL_ORIGINS = True | ||
from base import * |
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 @@ | ||
from base import * |
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 @@ | ||
from base import * |
Empty file.
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 @@ | ||
version: '3.4' | ||
|
||
services: | ||
equipoback: | ||
image: equipoback | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile.dev | ||
volumes: | ||
- ./api:/home/appuser/app | ||
ports: | ||
- 8000:8000 | ||
tty: true | ||
stdin_open: true | ||
command: /bin/bash | ||
|
||
db: | ||
image: postgres:13 | ||
restart: unless-stopped | ||
ports: | ||
- 5435:5432 | ||
environment: | ||
- name=value | ||
- POSTGRES_PASSWORD=passdb | ||
- POSTGRES_USER=db_user | ||
- POSTGRES_DB=db_name | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
|
||
volumes: | ||
pgdata: | ||
|
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,10 @@ | ||
version: '3.4' | ||
|
||
services: | ||
equipoback: | ||
image: equipoback | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
ports: | ||
- 8000: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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
cd /home/appuser/app/api | ||
|
||
python manage.py migrate | ||
|
||
exec "$@" |
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,8 @@ | ||
setup: | ||
addons: | ||
- plan: heroku-postgresql | ||
as: DATABASE | ||
build: | ||
docker: | ||
web: Dockerfile | ||
#Esto es opcional, si no esta presente usa el CMD del dockerfile |