sh8s_deployer/Specifications.md

94 lines
2.9 KiB
Markdown
Raw Normal View History

2024-07-29 11:08:47 +00:00
# Shlagernetes deployer - Specifications
# Context
Shlagernetes is an orchestration tool allowing services to be stored on second-hand servers. It handles the configuration of the servers, the installation and maintenance of services as well as their deletion. Services can be static or dynamic websites, VPNs, etc. They can be in a container if required but not necessarily.
2024-07-30 07:47:44 +00:00
Shlagernetes works with an nginx reverse proxy, wireguard VPN, letsencrypt ssl certification and git versioning.
2024-07-29 11:08:47 +00:00
Shl8s works with the principle of Infrastructure As Code.
2024-07-30 07:47:44 +00:00
On every server, there will be an instance of the Shl8s deployer, written in C.
2024-07-29 11:08:47 +00:00
The deployer will call bash scripts specific to the service, as well as functions from libraries specific to setting the nginx configuration, the vpn, ssl certification, etc.
2024-07-29 16:02:49 +00:00
# Call
2024-07-30 07:47:44 +00:00
./deployer deploy/remove all/service_name
2024-07-29 11:08:47 +00:00
# Description
2024-07-29 16:02:49 +00:00
2024-07-29 16:05:55 +00:00
deploy_service(service)
{
2024-07-29 16:04:58 +00:00
- determines if the service is on this server
if it is:
- creates directories (secret, data, http) if necessary
- calls the bash scripts specific to the service if they exist (deploy_as)
- creates user and .env variables if necessary
- calls the deployment functions from the libraries
2024-07-29 16:05:55 +00:00
}
2024-07-29 15:45:04 +00:00
2024-07-29 16:05:55 +00:00
remove_service(service) //should there be some kind of less absolute removal?
{
2024-07-29 16:04:58 +00:00
- determines if the service is on this server
if it is:
- calls the removing bash scripts specific to the service if they exist
- calls the removing functions from the libraries
- deletes .env variables
- deletes directories
- deletes user
2024-07-29 16:05:55 +00:00
- removes from .csv //should this get done before by the sysadmin? but how to check that something was here if it has been removed ?
}
2024-07-29 15:45:04 +00:00
**main.cpp**
2024-07-29 11:39:13 +00:00
- reads the instructions
2024-07-29 15:45:04 +00:00
If deploy all:
- checks the environment (/data/mounted and new nginx conf exists)
- prepares directories
2024-07-29 16:04:58 +00:00
- prepares Nginx
- prepares Docker
- prepares .env
for each service:
- deploy_service(service)
- (re)start nginx
2024-07-29 16:04:58 +00:00
- cleans
else if deploy one service:
- checks the environment (/data/mounted and new nginx conf exists)
2024-07-29 16:04:58 +00:00
- deploy_service(service)
- (re)start nginx
2024-07-29 16:04:58 +00:00
else if remove all:
for each service:
- remove_service(service)
- stop Docker
- stop wireguard
- stop Nginx
- cleans .env
- cleans
else if remove one service:
- remove_service(service)
2024-07-29 15:45:04 +00:00
**plugins/static libraries**
- nginx
2024-07-29 11:08:47 +00:00
preparation
deployment
writing new conf
2024-07-29 15:45:04 +00:00
testing
replacing old conf
start/restart
cleaning
2024-07-29 15:45:04 +00:00
stop
2024-07-29 11:39:13 +00:00
- wireguard
2024-07-29 15:45:04 +00:00
deploy (with and without namespace)
remove
- encryption
deploy
remove
2024-07-29 11:39:13 +00:00
- docker
2024-07-29 15:45:04 +00:00
preparation
deploy
remove
stop
clean
2024-07-29 11:08:47 +00:00
2024-07-29 15:45:04 +00:00
**functions/imports if too long**
- user creation
- environment variables handling
2024-07-29 11:08:47 +00:00