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
97f5c65d
Commit
97f5c65d
authored
2 years ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
add server deployment CI
parent
a4b89fb3
No related branches found
No related tags found
1 merge request
!14
Server deployment
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+28
-11
28 additions, 11 deletions
.gitlab-ci.yml
README.md
+4
-0
4 additions, 0 deletions
README.md
deploy.sh
+28
-0
28 additions, 0 deletions
deploy.sh
server.md
+63
-0
63 additions, 0 deletions
server.md
with
123 additions
and
11 deletions
.gitlab-ci.yml
+
28
−
11
View file @
97f5c65d
...
@@ -23,6 +23,11 @@ cache:
...
@@ -23,6 +23,11 @@ cache:
-
.cache/pip
-
.cache/pip
-
venv/
-
venv/
stages
:
-
build
-
test
-
deploy
build-job
:
build-job
:
stage
:
build
stage
:
build
script
:
script
:
...
@@ -48,14 +53,26 @@ test-job2:
...
@@ -48,14 +53,26 @@ test-job2:
-
source venv/bin/activate
-
source venv/bin/activate
-
mypy --config-file=pyproject.toml server
-
mypy --config-file=pyproject.toml server
deploy-to-production
:
#pages:
stage
:
deploy
# script:
script
:
# - pip install sphinx sphinx-rtd-theme
-
echo "Becoming 'nacsos' user"
# - cd doc ; make html
-
su - nacsos
# - mv build/html/ ../public/
-
cd /home/nacsos/nacsos-core
# artifacts:
-
echo "Stopping NACSOS-core service"
# paths:
-
systemctl --user stop nacsos-core
# - public
-
echo "Dropping virtual environment"
# rules:
-
rm -rf venv
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
-
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 "Exiting 'nacsos' user scope"
-
echo "Starting NACSOS-core service"
-
systemctl --user start nacsos-core
only
:
-
production
This diff is collapsed.
Click to expand it.
README.md
+
4
−
0
View file @
97f5c65d
...
@@ -3,6 +3,10 @@ This repository contains the core data management platform of NACSOS.
...
@@ -3,6 +3,10 @@ This repository contains the core data management platform of NACSOS.
It accesses the database via the
`nacsos-data`
package and exposes the functionality via an API.
It accesses the database via the
`nacsos-data`
package and exposes the functionality via an API.
It also serves the web frontend.
It also serves the web frontend.
```
pg_dump -d nacsos_core -h localhost -U root -W -p 5432 > dump.sql
```
## Installation
## Installation
-
Requires Python 3.10+, tested with Python 3.10.2
-
Requires Python 3.10+, tested with Python 3.10.2
...
...
This diff is collapsed.
Click to expand it.
deploy.sh
0 → 100644
+
28
−
0
View file @
97f5c65d
echo
"Stopping NACSOS-core service"
syetemctl stop nacos-core
echo
"Becoming 'nacsos' user"
su - nacsos
cd
/home/nacsos/nacsos-core
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
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
"Starting NACSOS-core service"
systemctl start nacsos-core
This diff is collapsed.
Click to expand it.
server.md
0 → 100644
+
63
−
0
View file @
97f5c65d
Postgres users:
```
nacsos (admin): $v5aCh$kGE9ybF@XtE*%CETA&4bXt8vu$NTZUxi*J@f%
nacsos_user (user): HqVxmmuJgPR#4dYL8m%32JLG$c#%kkwqoWB4vQay@Rbr
```
UNIX users:
```
username: nacsos
password: none
home at /home/nacsos
(not sudo, no extra groups)
```
## Systemd Setup
### NACSOS-core
Create
`/.config/systemd/user/nacsos-core.service`
```
[Unit]
Description=NACSOS core server
After=network.target
[Service]
User=nacsos
WorkingDirectory=/home/nacsos/nacsos-core
LimitNOFILE=4096
ExecStart=/home/nacsos/nacsos-core/venv/bin/python -m hypercorn main:app --config=config/hypercorn-server.toml
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
```
```
bash
sudo
systemctl daemon-reload
sudo
systemctl
enable
nacsos-core
sudo
systemctl start nacsos-core
```
### NACSOS-pipes
Create
`/etc/systemd/system/nacsos-pipes.service`
```
[Unit]
Description=NACSOS core server
After=network.target
[Service]
User=nacsos
WorkingDirectory=/home/nacsos/nacsos-core
LimitNOFILE=4096
ExecStart=/home/nacsos/nacsos-core/venv/bin/python -m hypercorn main:app --config=config/hypercorn-server.toml
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
```
\ 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