Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7ffc9474
authored
Jul 24, 2020
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ci stages and stagigng deployment
parent
915ac7b4
Pipeline
#1280
passed with stages
in 4 minutes 11 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
7 deletions
+34
-7
.env.example
+1
-1
.gitlab-ci.yml
+27
-5
Dockerfile
+1
-0
Dockerfile.prod
+1
-0
docker-compose.prod.yml
+2
-0
setup_ci_env.sh
+2
-1
No files found.
.env.example
View file @
7ffc9474
...
@@ -12,7 +12,7 @@ DJANGO_SETTINGS_MODULE=myproject.settings.local
...
@@ -12,7 +12,7 @@ DJANGO_SETTINGS_MODULE=myproject.settings.local
DATABASE_PASSWORD=database_password
DATABASE_PASSWORD=database_password
DATABASE_USER=user
DATABASE_USER=user
DATABASE_NAME=user
DATABASE_NAME=user
DATABASE_HOST=hostname_of_
b
atabase
DATABASE_HOST=hostname_of_
d
atabase
# For channels communication and periodic tasks we need a redis server
# For channels communication and periodic tasks we need a redis server
REDIS_HOST=redis_host
REDIS_HOST=redis_host
...
...
.gitlab-ci.yml
View file @
7ffc9474
...
@@ -6,16 +6,38 @@ before_script:
...
@@ -6,16 +6,38 @@ before_script:
-
git submodule sync --recursive
-
git submodule sync --recursive
-
git submodule update --init --recursive
-
git submodule update --init --recursive
stages
:
-
testing
-
build
-
deploy
flake8
:
flake8
:
stage
:
testing
script
:
script
:
-
python3.6 -m pip install flake8
-
python3.6 -m pip install flake8
-
flake8
-
flake8
build-local
:
test
:
stage
:
testing
script
:
script
:
-
docker build --tag recircle-backend:1.0 .
-
docker build --tag recircle-backend-local:latest .
-
docker run recircle-backend-local:latest pipenv run python manage.py test
test
:
build_prod_image
:
stage
:
build
script
:
script
:
-
docker build --tag recircle-backend:1.0 .
-
docker build -f ./Dockerfile.prod --tag recircle-backend:latest .
-
docker run recircle-backend:1.0 pipenv run python manage.py test
# deploy needs sshpass installed on gitlab runner machince
deploy_staging
:
stage
:
deploy
tags
:
-
ssh-deploy-staging
script
:
# When the docker registry ready, pull images from it
-
docker-compose -f docker-compose.prod.yml up -d --build
environment
:
name
:
staging
url
:
http://vm.niif.cloud.bme.hu:20088
only
:
-
DEV
-
master
Dockerfile
View file @
7ffc9474
...
@@ -9,6 +9,7 @@ EXPOSE 8000/tcp
...
@@ -9,6 +9,7 @@ EXPOSE 8000/tcp
COPY
Pipfile* .env ./
COPY
Pipfile* .env ./
# This env variable needed to pipenv find .env file
# This env variable needed to pipenv find .env file
ENV
PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
ENV
PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
ENV
DJANGO_SETTINGS_MODULE=recircle.settings.local
# Install dependencies
# Install dependencies
RUN
pipenv install
-d
RUN
pipenv install
-d
# Copy sources
# Copy sources
...
...
Dockerfile.prod
View file @
7ffc9474
...
@@ -9,6 +9,7 @@ EXPOSE 8000/tcp
...
@@ -9,6 +9,7 @@ EXPOSE 8000/tcp
COPY Pipfile* .env ./
COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file
# This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
ENV DJANGO_SETTINGS_MODULE=recircle.settings.prod
# Install dependencies
# Install dependencies
RUN pipenv install
RUN pipenv install
# Copy sources
# Copy sources
...
...
docker-compose.prod.yml
View file @
7ffc9474
...
@@ -19,6 +19,8 @@ services:
...
@@ -19,6 +19,8 @@ services:
POSTGRES_PASSWORD
:
${DATABASE_PASSWORD}
POSTGRES_PASSWORD
:
${DATABASE_PASSWORD}
POSTGRES_USER
:
${DATABASE_USER}
POSTGRES_USER
:
${DATABASE_USER}
POSTGRES_DB
:
${DATABASE_NAME}
POSTGRES_DB
:
${DATABASE_NAME}
volumes
:
-
/database/recircle:/var/lib/postgresql/data
networks
:
networks
:
-
backend
-
backend
...
...
setup_ci_env.sh
View file @
7ffc9474
#!/bin/bash
#!/bin/bash
## This file used by the gitlab ci runner
## Reads the environment variables from the CI config then echoes it to the .env file
# This variables are interpreted automatically by the Docker Engine
# This variables are interpreted automatically by the Docker Engine
# And by the Django runtime
# And by the Django runtime
# Django configuration
# Django configuration
echo
DJANGO_SECRET
=
${
DJANGO_SECRET
}
>>
.env
echo
DJANGO_SECRET
=
${
DJANGO_SECRET
}
>>
.env
echo
DJANGO_SETTINGS_MODULE
=
${
DJANGO_SETTINGS_MODULE
}
>>
.env
# If using other database than sqlite3 (only use sqlite for development!)
# If using other database than sqlite3 (only use sqlite for development!)
# Provide the db credentials here
# Provide the db credentials here
echo
DATABASE_PASSWORD
=
${
DATABASE_PASSWORD
}
>>
.env
echo
DATABASE_PASSWORD
=
${
DATABASE_PASSWORD
}
>>
.env
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment