From b828274d003ac553b5eaf0b5f82fd6e4964fd967 Mon Sep 17 00:00:00 2001 From: Rafi Madani <rafi.madani@ui.ac.id> Date: Tue, 6 Feb 2024 17:13:23 +0700 Subject: [PATCH] deploy railway --- .gitlab-ci.yml | 20 +++++++++++++++----- project_a4_logistik/settings.py | 5 ++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8461d99e..9be0ea69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -71,12 +71,22 @@ django-tests: stage: test script: # The MYSQL user only gets permissions for MYSQL_DB, so Django can't create a test database. - - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql + # - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql + # line diatas bikin test failed # use python3 explicitly. see https://wiki.ubuntu.com/Python/3 - python3 manage.py test -deploy: - stage: deploy - script: echo "Define your deployment script!" - environment: production +stages: + - deploy +deploy-railway: + stage: deploy + image: ubuntu + only: + - master + script: + - apt-get clean + - apt-get -o Acquire::ForceIPv4=true update + - apt-get install -y curl + - curl -fsSL https://railway.app/install.sh | sh + - railway up --service=$RAILWAY_SERVICE_NAME -d diff --git a/project_a4_logistik/settings.py b/project_a4_logistik/settings.py index 9887195e..250d37fb 100644 --- a/project_a4_logistik/settings.py +++ b/project_a4_logistik/settings.py @@ -25,7 +25,10 @@ SECRET_KEY = 'django-insecure-de*63$hz+#$#*@#@ke6n^@1yvtysnf^z$-=2oqd6x0knr96)@@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = [ + 'aquatic-metal-production.up.railway.app', + # Add any other allowed hosts here if needed +] # Application definition -- GitLab