-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into master-github
- Loading branch information
Showing
38 changed files
with
450 additions
and
311 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,65 +1,63 @@ | ||
stages: | ||
- test | ||
- deploy | ||
- deploy-aws | ||
- test | ||
- deploy | ||
|
||
cache: | ||
key: ${CI_COMMIT_REF_SLUG} | ||
paths: | ||
- .venv/ | ||
|
||
test: | ||
image: python:3.7 | ||
image: python:3.7-slim | ||
stage: test | ||
services: | ||
- postgres:10.9 | ||
- postgres:10.9-alpine | ||
variables: | ||
DJANGO_SETTINGS_MODULE: "app.settings.test" | ||
DATABASE_URL: postgres://testuser:testpass@postgres/test_db | ||
POSTGRES_USER: testuser | ||
POSTGRES_PASSWORD: testpass | ||
script: | ||
- pip install virtualenv # set up local venv dir for caching of packages | ||
- virtualenv .venv | ||
- source .venv/bin/activate | ||
- pip install -r requirements-dev.txt | ||
- black --check . | ||
- pytest src -p no:warnings | ||
|
||
deploydevelop: | ||
image: ilyasemenov/gitlab-ci-git-push | ||
stage: deploy | ||
script: git-push [email protected]:bullet-train | ||
only: | ||
- develop | ||
image: ilyasemenov/gitlab-ci-git-push | ||
stage: deploy | ||
script: git-push [email protected]:bullet-train | ||
only: | ||
- develop | ||
|
||
.deploy_to_beanstalk: &deploy_to_beanstalk | | ||
echo "Deploying to beanstalk with label $CI_COMMIT_SHORT_SHA" | ||
cp requirements.txt ./src/requirements.txt | ||
cd src | ||
eb deploy $ENVIRONMENT_NAME -l "$CI_COMMIT_SHORT_SHA" | ||
|
||
deployawsstaging: | ||
image: bullettrain/elasticbeanstalk-pipenv # TODO: remove pipenv from this docker image | ||
stage: deploy-aws | ||
script: | ||
- export AWS_ACCESS_KEY_ID=$AWS_STAGING_ACCESS_KEY_ID | ||
- export AWS_SECRET_ACCESS_KEY=$AWS_STAGING_SECRET_ACCESS_KEY | ||
- export DATABASE_URL=$DATABASE_URL_STAGING | ||
- export GOOGLE_ANALYTICS_CLIENT_ID=$GOOGLE_ANALYTICS_CLIENT_ID_STAGING | ||
- export GOOGLE_ANALYTICS_KEY=$GOOGLE_ANALYTICS_KEY_STAGING | ||
- export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE_STAGING | ||
- cp requirements.txt ./src/requirements.txt | ||
- sh generate.sh | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "Gitlab" | ||
- git add . && git commit -m "Commit to EB" | ||
- cd src | ||
- eb deploy $EB_ENVIRONMENT_STAGING | ||
only: | ||
- staging | ||
image: flagsmith/eb-cli:latest | ||
stage: deploy | ||
variables: | ||
ENVIRONMENT_NAME: staging-api | ||
AWS_ACCESS_KEY_ID: "$AWS_STAGING_ACCESS_KEY_ID" | ||
AWS_SECRET_ACCESS_KEY: "$AWS_STAGING_SECRET_ACCESS_KEY" | ||
script: | ||
- *deploy_to_beanstalk | ||
only: | ||
- staging | ||
|
||
deployawsmaster: | ||
image: bullettrain/elasticbeanstalk-pipenv | ||
stage: deploy-aws | ||
script: | ||
- export DATABASE_URL=$DATABASE_URL_PRODUCTION | ||
- export GOOGLE_ANALYTICS_CLIENT_ID=$GOOGLE_ANALYTICS_CLIENT_ID_PRODUCTION | ||
- export GOOGLE_ANALYTICS_KEY=$GOOGLE_ANALYTICS_KEY_PRODUCTION | ||
- export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE_PRODUCTION | ||
- cp requirements.txt ./src/requirements.txt | ||
- sh generate.sh | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "Gitlab" | ||
- git add . && git commit -m "Commit to EB" | ||
- cd src | ||
- eb deploy $EB_ENVIRONMENT_PRODUCTION --timeout 30 | ||
only: | ||
- master | ||
- master-aws | ||
image: flagsmith/eb-cli:latest | ||
stage: deploy | ||
variables: | ||
ENVIRONMENT_NAME: production-api | ||
AWS_ACCESS_KEY_ID: "$AWS_PRODUCTION_ACCESS_KEY_ID" | ||
AWS_SECRET_ACCESS_KEY: "$AWS_PRODUCTION_SECRET_ACCESS_KEY" | ||
script: | ||
- *deploy_to_beanstalk | ||
only: | ||
- master |
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 @@ | ||
## Overview of the Merge Request | ||
|
||
This Merge Request works by... | ||
|
||
## Have you written tests? | ||
|
||
If not, explain here! |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,20 +1,13 @@ | ||
FROM python:3.7 | ||
FROM python:3.8-slim as application | ||
|
||
RUN rm /var/lib/dpkg/info/format | ||
RUN printf "1\n" > /var/lib/dpkg/info/format | ||
RUN dpkg --configure -a | ||
RUN apt-get clean && apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
COPY requirements.txt /app/ | ||
COPY src/ /app/src/ | ||
COPY docker/bin/ /app/bin/ | ||
|
||
RUN pip install pipenv | ||
|
||
WORKDIR /usr/src | ||
COPY src/ ./ | ||
COPY Pipfile* ./ | ||
RUN pipenv install --deploy | ||
RUN pip install -r requirements.txt | ||
|
||
ENV DJANGO_SETTINGS_MODULE=app.settings.master-docker | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["./bin/docker"] |
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,18 @@ | ||
FROM python:3-slim | ||
|
||
ENV BUILD_DIR=/build | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y \ | ||
build-essential zlib1g-dev libssl-dev libncurses-dev git \ | ||
libffi-dev libsqlite3-dev libreadline-dev libbz2-dev curl | ||
|
||
RUN mkdir $BUILD_DIR | ||
WORKDIR ${BUILD_DIR} | ||
|
||
RUN git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git | ||
|
||
RUN pip install virtualenv | ||
RUN python aws-elastic-beanstalk-cli-setup/scripts/ebcli_installer.py --location $BUILD_DIR | ||
|
||
ENV PATH="${BUILD_DIR}/.ebcli-virtual-env/bin:${PATH}" |
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,13 @@ | ||
FROM python:3.8 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY requirements.txt requirements-dev.txt /app/ | ||
COPY src/ /app/src/ | ||
COPY docker/bin/ /app/bin/ | ||
|
||
RUN pip install -r requirements-dev.txt | ||
|
||
ENV DJANGO_SETTINGS_MODULE=app.settings.master-docker | ||
EXPOSE 8000 |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
container_commands: | ||
01_migrate: | ||
command: "django-admin.py migrate" | ||
command: django-admin.py migrate | ||
leader_only: true | ||
02_collectstatic: | ||
command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput" | ||
command: python manage.py collectstatic --noinput | ||
option_settings: | ||
aws:elasticbeanstalk:application:environment: | ||
DJANGO_SETTINGS_MODULE: app.settings.production |
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
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
Oops, something went wrong.