Skip to content
Snippets Groups Projects
Commit 846bb73a authored by Tim Repke's avatar Tim Repke
Browse files

Merge branch 'server-deployment' into 'production'

switch to using script

See merge request !9
parents 4f4e2517 479dc08e
No related branches found
No related tags found
1 merge request!9switch to using script
Pipeline #993 canceled
......@@ -51,35 +51,34 @@ deploy-to-production:
tags:
- bare-metal
script:
- echo "Current working directory"
- pwd
- echo "Current user"
- whoami
- groups
- echo "Becoming 'nacsos' user"
- sudo -u nacsos bash
- cd /home/nacsos/nacsos-core
- pwd
- whoami
- groups
- echo "Stopping NACSOS-core service"
- sudo systemctl stop nacsos-core.service
- echo "Dropping virtual environment"
- rm -rf venv
- echo "Fetching updated source"
- git stash # "reset" softly by stashing (in case files changed)
- git pull origin production # pull from origin (production branch)
- echo "Creating new virtual environment"
- python3.10 -m venv venv
- source venv/bin/activate
- echo "Installing requirements"
- pip install -r requirements.txt
- echo "Handling migrations"
- pip install alembic
- cd venv/src/nacsos-data/
- alembic upgrade head
- echo "Starting NACSOS-core service"
- sudo systemctl start nacsos-core.service
- echo "Run as nacsos user"
- sudo -u nacsos ./deploy.sh
# - echo "Current working directory"
# - pwd
# - echo "Current user"
# - whoami
# - groups
# - echo "Becoming 'nacsos' user"
# - sudo -u nacsos -s
# - cd /home/nacsos/nacsos-core
# - echo "Stopping NACSOS-core service"
# - sudo systemctl stop nacsos-core.service
# - echo "Dropping virtual environment"
# - rm -rf venv
# - echo "Fetching updated source"
# - git stash # "reset" softly by stashing (in case files changed)
# - git pull origin production # pull from origin (production branch)
# - echo "Creating new virtual environment"
# - python3.10 -m venv venv
# - source venv/bin/activate
# - echo "Installing requirements"
# - pip install -r requirements.txt
# - echo "Handling migrations"
# - pip install alembic
# - cd venv/src/nacsos-data/
# - alembic upgrade head
# - echo "Starting NACSOS-core service"
# - sudo systemctl start nacsos-core.service
when: manual
only:
- production
echo "Stopping NACSOS-core service"
syetemctl stop nacos-core
echo "Current working directory"
pwd
ls -lisah
echo "Current user"
whoami
echo "Current groups"
groups
echo "Becoming 'nacsos' user"
su - nacsos
echo "Changing directory and making sure we landed there"
cd /home/nacsos/nacsos-core
pwd
ls -lisah
echo "Stopping NACSOS-core service"
sudo systemctl stop nacsos-core.service
echo "Dropping virtual environment"
rm -rf venv
echo "Fetching updated source"
# "reset" softly by stashing (in case files changed)
git stash
# pull from origin (production branch)
git pull origin production
git stash # "reset" softly by stashing (in case files changed)
git pull origin production # pull from origin (production branch)
echo "Creating new virtual environment"
python3.10 -m venv venv
source venv/bin/activate
echo "Installing requirements"
pip install -r requirements.txt
echo "Exiting 'nacsos' user scope"
exit
echo "Handling migrations"
pip install alembic
cd venv/src/nacsos-data/
alembic upgrade head
echo "Starting NACSOS-core service"
systemctl start nacsos-core
sudo systemctl start nacsos-core.service
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment