Add Gitlab CI support

This commit is contained in:
rubenwardy
2020-01-19 15:51:47 +00:00
parent d503908a65
commit fd6ba459f9
13 changed files with 73 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Open SSH to app instance

View File

@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/sh
# Create a database migration, and copy it back to the host.
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate"
docker exec -u root -it contentdb_app_1 sh -c "cp /home/cdb/migrations/versions/* /source/migrations/versions/"
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate"
docker exec -u root contentdb_app_1 sh -c "cp /home/cdb/migrations/versions/* /source/migrations/versions/"
USER=$(whoami)
sudo chown -R $USER:$USER migrations/versions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# Open SQL console for the database

31
utils/gitlabci/config.cfg Normal file
View File

@@ -0,0 +1,31 @@
USER_APP_NAME="Content DB"
SERVER_NAME="localhost:5123"
BASE_URL="http://" + SERVER_NAME
SECRET_KEY="changeme"
WTF_CSRF_SECRET_KEY="changeme"
SQLALCHEMY_DATABASE_URI = "postgres://contentdb:password@db:5432/contentdb"
GITHUB_CLIENT_ID = ""
GITHUB_CLIENT_SECRET = ""
REDIS_URL='redis://redis:6379'
CELERY_BROKER_URL='redis://redis:6379'
CELERY_RESULT_BACKEND='redis://redis:6379'
USER_ENABLE_USERNAME = True
USER_ENABLE_REGISTER = False
USER_ENABLE_CHANGE_USERNAME = False
USER_ENABLE_EMAIL = False
MAIL_UTILS_ERROR_SEND_TO = [""]
UPLOAD_DIR="/var/cdb/uploads/"
THUMBNAIL_DIR="/var/cdb/thumbnails/"
TEMPLATES_AUTO_RELOAD = True
LANGUAGES = {
'en': 'English',
}

View File

@@ -0,0 +1,4 @@
POSTGRES_USER=contentdb
POSTGRES_PASSWORD=password
POSTGRES_DB=contentdb
FLASK_DEBUG=1

View File

@@ -1,5 +1,5 @@
#!/bin/bash
#!/bin/sh
# Hot/live reload - only works in debug mode
docker exec -it contentdb_app_1 sh -c "cp -r /source/* ."
docker exec contentdb_app_1 sh -c "cp -r /source/* ."

View File

@@ -1,5 +1,5 @@
#!/bin/bash
#!/bin/sh
# Run all pending migrations
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade"
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade"

View File

@@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py python -m pytest app/tests/ --disable-warnings"
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py python -m pytest app/tests/ --cov=app --disable-warnings"