diff --git a/CHANGELOG.md b/CHANGELOG.md index bbb49eaf5..b05bd3e70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [2.2.1](https://github.com/gradido/gradido/compare/2.2.0...2.2.1) + +- fix(other): deployment bugfixes [`#3290`](https://github.com/gradido/gradido/pull/3290) + #### [2.2.0](https://github.com/gradido/gradido/compare/2.1.1...2.2.0) +> 9 February 2024 + +- chore(release): v2.2.0 [`#3283`](https://github.com/gradido/gradido/pull/3283) +- fix(backend): prevent warning, fix env error [`#3282`](https://github.com/gradido/gradido/pull/3282) - feat(frontend): update news text [`#3279`](https://github.com/gradido/gradido/pull/3279) - feat(frontend): use params instead of query for send/identifier route [`#3277`](https://github.com/gradido/gradido/pull/3277) - fix(other): deployment bugfixes [`#3276`](https://github.com/gradido/gradido/pull/3276) diff --git a/admin/package.json b/admin/package.json index b1a2bd044..97d4f6fda 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "2.2.0", + "version": "2.2.1", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index 8f70ab11e..b7923c212 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index caeb917c4..c0f7496f0 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/deployment/hetzner_cloud/README.md b/deployment/hetzner_cloud/README.md index d2cd66a35..a0dfe79e3 100644 --- a/deployment/hetzner_cloud/README.md +++ b/deployment/hetzner_cloud/README.md @@ -1,3 +1,6 @@ +# Migration +[Migration from 2.2.0 to 2.2.1](migration/2_2_0-2_2_1/README.md) + # Setup on Hetzner Cloud Server Suggested OS: Debian 12 diff --git a/deployment/hetzner_cloud/install.sh b/deployment/hetzner_cloud/install.sh index b51f9b454..1be3548cc 100755 --- a/deployment/hetzner_cloud/install.sh +++ b/deployment/hetzner_cloud/install.sh @@ -144,7 +144,13 @@ cp $SCRIPT_PATH/logrotate/gradido.conf /etc/logrotate.d/gradido.conf export DB_USER=gradido # create a new password only if it not already exist if [ -z "${DB_PASSWORD}" ]; then - export DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); + export DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo); +fi + +# Check if DB_PASSWORD is still empty, then exit with an error +if [ -z "${DB_PASSWORD}" ]; then + echo "Error: Failed to generate DB_PASSWORD." + exit 1 fi mysql < $PROJECT_ROOT/database/.env # Configure backend -export JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo); +export JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo); envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/backend/.env.template > $PROJECT_ROOT/backend/.env # Configure frontend @@ -166,7 +172,7 @@ envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/frontend/.env envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/admin/.env.template > $PROJECT_ROOT/admin/.env # Configure dht-node -export FEDERATION_DHT_SEED=$(< /dev/urandom tr -dc a-f0-9 | head -c 32;echo); +export FEDERATION_DHT_SEED=$(< /dev/urandom tr -dc a-f0-9 | head -c 32; echo); envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/dht-node/.env.template > $PROJECT_ROOT/dht-node/.env # Configure federation @@ -180,4 +186,4 @@ sudo -u gradido crontab < $LOCAL_SCRIPT_DIR/crontabs.txt # Start gradido # Note: on first startup some errors will occur - nothing serious -sudo -u gradido $SCRIPT_PATH/start.sh \ No newline at end of file +sudo -u gradido $SCRIPT_PATH/start.sh $1 \ No newline at end of file diff --git a/deployment/hetzner_cloud/migration/2_2_0-2_2_1/README.md b/deployment/hetzner_cloud/migration/2_2_0-2_2_1/README.md new file mode 100644 index 000000000..38c4e8330 --- /dev/null +++ b/deployment/hetzner_cloud/migration/2_2_0-2_2_1/README.md @@ -0,0 +1,18 @@ +## Migrate from Gradido Version 2.2.0 to 2.2.1 +### What was wrong +In [hetzner_cloud/install.sh](../../install.sh) there was an error. +$DB_PASSWORD and $JWT_SECRET password generation method don't work with `release-2_2_0` as parameter for install.sh + +The Parameter forwarding from branch, `release-2_2_0` in this case to start.sh was also missing. + +### What you can do now +You need to only run this [fixInstall.sh](fixInstall.sh) with `release_2_2_1` as parameter +```bash +cd /home/gradido/gradido/deployment/hetzner_cloud/migration/2_2_0-2_2_1 +sudo ./fixInstall.sh `release_2_2_1` +``` + +Basically it will create a new $DB_PASSWORD, $JWT_SECRET and $FEDERATION_DHT_SEED, +update db user with new db password and update .env files in module folders. +Then it will call start.sh with first parameter if ./fixInstall.sh as his first parameter + diff --git a/deployment/hetzner_cloud/migration/2_2_0-2_2_1/fixInstall.sh b/deployment/hetzner_cloud/migration/2_2_0-2_2_1/fixInstall.sh new file mode 100755 index 000000000..1995b220d --- /dev/null +++ b/deployment/hetzner_cloud/migration/2_2_0-2_2_1/fixInstall.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# check for parameter +if [ -z "$1" ]; then + echo "Usage: Please provide a branch name as the first argument." + exit 1 +fi + +set -o allexport +SCRIPT_PATH=$(realpath ../../../bare_metal) +SCRIPT_DIR=$(dirname $SCRIPT_PATH) +LOCAL_SCRIPT_PATH=$(realpath $0) +LOCAL_SCRIPT_DIR=$(dirname $LOCAL_SCRIPT_PATH) +PROJECT_ROOT=$SCRIPT_DIR/.. +set +o allexport + + +# Load .env or .env.dist if not present +# NOTE: all config values will be in process.env when starting +# the services and will therefore take precedence over the .env +if [ -f "$SCRIPT_PATH/.env" ]; then + set -o allexport + source $SCRIPT_PATH/.env + set +o allexport +else + set -o allexport + source $SCRIPT_PATH/.env.dist + set +o allexport +fi + +# create db user +export DB_USER=gradido +# create a new password only if it not already exist +export DB_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo); + + +mysql < $PROJECT_ROOT/database/.env + +# Configure backend +export JWT_SECRET=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo); +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/backend/.env.template > $PROJECT_ROOT/backend/.env + +# Configure frontend +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/frontend/.env.template > $PROJECT_ROOT/frontend/.env + +# Configure admin +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/admin/.env.template > $PROJECT_ROOT/admin/.env + +# Configure dht-node +export FEDERATION_DHT_SEED=$(< /dev/urandom tr -dc a-f0-9 | head -c 32; echo); +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/dht-node/.env.template > $PROJECT_ROOT/dht-node/.env + +# Configure federation +envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $PROJECT_ROOT/federation/.env.template > $PROJECT_ROOT/federation/.env + +# set all created or modified files back to belonging to gradido +chown -R gradido:gradido $PROJECT_ROOT + +# Start gradido +# Note: on first startup some errors will occur - nothing serious +sudo -u gradido $SCRIPT_PATH/start.sh $1 \ No newline at end of file diff --git a/dht-node/package.json b/dht-node/package.json index 7a73791d5..a4859e394 100644 --- a/dht-node/package.json +++ b/dht-node/package.json @@ -1,6 +1,6 @@ { "name": "gradido-dht-node", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido dht-node module", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/", diff --git a/dlt-connector/package.json b/dlt-connector/package.json index 7aa8aa10d..30cd4b33b 100644 --- a/dlt-connector/package.json +++ b/dlt-connector/package.json @@ -1,6 +1,6 @@ { "name": "gradido-dlt-connector", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido DLT-Connector", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/", diff --git a/federation/package.json b/federation/package.json index fcfaa0e46..9a74201ab 100644 --- a/federation/package.json +++ b/federation/package.json @@ -1,6 +1,6 @@ { "name": "gradido-federation", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido federation module providing Gradido-Hub-Federation and versioned API for inter community communication", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/federation", diff --git a/frontend/package.json b/frontend/package.json index e54ffa263..4dd840261 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "2.2.0", + "version": "2.2.1", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index b85be6f24..8ed31de63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "2.2.0", + "version": "2.2.1", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",