Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
846bb73a
Commit
846bb73a
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Plain Diff
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
!9
switch to using script
Pipeline
#993
canceled
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+28
-29
28 additions, 29 deletions
.gitlab-ci.yml
deploy.sh
+20
-12
20 additions, 12 deletions
deploy.sh
with
48 additions
and
41 deletions
.gitlab-ci.yml
+
28
−
29
View file @
846bb73a
...
...
@@ -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
This diff is collapsed.
Click to expand it.
deploy.sh
+
20
−
12
View file @
846bb73a
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment