[add] deploy script

This commit is contained in:
oldnick85
2024-01-08 16:26:29 +03:00
parent d258af16a3
commit ccb785a951
6 changed files with 39 additions and 7 deletions
+2
View File
@@ -0,0 +1,2 @@
secrets/**
!secrets/settings_pattern.json
+12 -6
View File
@@ -8,24 +8,30 @@ No clearnet for i2p, only yggdrasil!
At startup, the script searches YGGDRASIL public peers and chooses several best of them. At startup, the script searches YGGDRASIL public peers and chooses several best of them.
Then it generates YGGDRASIL *PublicKey* and *PrivateKey* unless the keys not set in environment variables. Then it generates YGGDRASIL *PublicKey* and *PrivateKey* unless the keys not set in environment variables.
## Preparations
Before building and deploying i2pd_yggdrasil docker image, you need to run the script
> bash support/requirements.sh
## Building ## Building
You can build docker image by simply run script *make_i2pd_yggdrasil_docker_image.sh*. You can build docker image by simply run script *make_i2pd_yggdrasil_docker_image.sh*.
> bash make_i2pd_yggdrasil_docker_image.sh > bash support/make_docker_image.sh
Feel free to modify it with your own building arguments. Feel free to modify it with your own building arguments.
## Running ## Running
To run docker container just run script *run_i2pd_yggdrasil_docker_image.sh* To run docker container just use docker-compose like this
> bash run_i2pd_yggdrasil_docker_image.sh > docker-compose -f src/docker-compose.yml up -d
## Deploy ## Deploy
To deploy built image to your host just execute this from command line To deploy built image to your host use script
> docker save i2pd_yggdrasil:latest | bzip2 | pv | ssh user@host docker load > bash support/docker_deploy.sh
> scp run_i2pd_yggdrasil_docker_image.sh user@host:. Note, this script takes parameters from *secrets/settings.json*, look *secrets/settings_pattern.json* for example.
+8
View File
@@ -0,0 +1,8 @@
{
"deploy" :
{
"host" : "0.0.0.0",
"user" : "root",
"path" : "/opt"
}
}
+1 -1
View File
@@ -21,4 +21,4 @@ services:
- "10765:10765" - "10765:10765"
- "10654:10654" - "10654:10654"
- "9001:9001" - "9001:9001"
restart: always
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
echo "Deploy i2pd yggdrasil"
host=$(cat secrets/settings.json | jq -r .deploy.host)
user=$(cat secrets/settings.json | jq -r .deploy.user)
path=$(cat secrets/settings.json | jq -r .deploy.path)
echo " stop docker container"
ssh -l ${user} ${host} "cd ${path} ; docker-compose down"
echo " upload docker images"
ssh ${user}@${host} "mkdir -p ${path}"
docker save i2pd_yggdrasil:latest | bzip2 | pv | ssh ${user}@${host} docker load
echo " upload docker compose"
scp src/docker-compose.yml ${user}@${host}:${path}
echo " start docker container"
ssh -l ${user} ${host} "cd ${path} ; docker-compose up -d"
echo " all done"
+1
View File
@@ -0,0 +1 @@
sudo apt install pv jq