mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
adjust script to handle seeding, regeneration of configs and alow unprivileged user to execute start.sh
This commit is contained in:
parent
41ee819aba
commit
1d59fc7a4e
@ -2,6 +2,8 @@ NGINX_SERVER_NAME=_
|
|||||||
|
|
||||||
#Example data
|
#Example data
|
||||||
|
|
||||||
|
#DEPLOY_SEED_DATA=true
|
||||||
|
#
|
||||||
#NGINX_REWRITE_LEGACY_URLS=true
|
#NGINX_REWRITE_LEGACY_URLS=true
|
||||||
#NGINX_SSL=true
|
#NGINX_SSL=true
|
||||||
#NGINX_SERVER_NAME=stage1.gradido.net
|
#NGINX_SERVER_NAME=stage1.gradido.net
|
||||||
|
|||||||
@ -100,19 +100,9 @@ sudo certbot --certonly
|
|||||||
> Would you be willing, once your first certificate is successfully issued, to > N
|
> Would you be willing, once your first certificate is successfully issued, to > N
|
||||||
> No names were found in your configuration files. Please enter in your domain > stage1.gradido.net
|
> No names were found in your configuration files. Please enter in your domain > stage1.gradido.net
|
||||||
|
|
||||||
# Generate gradido.conf from template
|
git config pull.ff only
|
||||||
# TODO order - first certbot, then nginx setup
|
|
||||||
case "$NGINX_SSL" in
|
|
||||||
true) TEMPLATE_FILE="gradido.conf.ssl.template" ;;
|
|
||||||
*) TEMPLATE_FILE="gradido.conf.template" ;;
|
|
||||||
esac
|
|
||||||
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $TEMPLATE_FILE > gradido.conf
|
|
||||||
|
|
||||||
# Generate update-page.conf from template
|
# Allow nginx configuration and restart for gradido
|
||||||
case "$NGINX_SSL" in
|
sudo nano /etc/sudoers.d/gradido
|
||||||
true) TEMPLATE_FILE="update-page.conf.ssl.template" ;;
|
> gradido ALL=(ALL) NOPASSWD: /etc/init.d/nginx start,/etc/init.d/nginx stop,/etc/init.d/nginx restart
|
||||||
*) TEMPLATE_FILE="update-page.conf.template" ;;
|
sudo chmod a+rw /etc/nginx/sites-enabled
|
||||||
esac
|
|
||||||
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $TEMPLATE_FILE > update-page.conf
|
|
||||||
|
|
||||||
git config pull.ff only
|
|
||||||
@ -6,6 +6,7 @@ SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
|||||||
LOCK_FILE=$SCRIPT_DIR/update.lock
|
LOCK_FILE=$SCRIPT_DIR/update.lock
|
||||||
UPDATE_HTML=$SCRIPT_DIR/nginx/update-page/updating.html
|
UPDATE_HTML=$SCRIPT_DIR/nginx/update-page/updating.html
|
||||||
PROJECT_ROOT=$SCRIPT_DIR/../../
|
PROJECT_ROOT=$SCRIPT_DIR/../../
|
||||||
|
NGINX_CONFIG_DIR=$SCRIPT_DIR/nginx/sites-available
|
||||||
|
|
||||||
# Load .env or .env.dist if not present
|
# Load .env or .env.dist if not present
|
||||||
set -o allexport
|
set -o allexport
|
||||||
@ -31,8 +32,8 @@ UPDATE_SITE_CONFIG=stage1_updating
|
|||||||
|
|
||||||
# configure nginx for the update-page
|
# configure nginx for the update-page
|
||||||
echo 'Configuring nginx to serve the update-page<br>' >> $UPDATE_HTML
|
echo 'Configuring nginx to serve the update-page<br>' >> $UPDATE_HTML
|
||||||
sudo rm /etc/nginx/sites-enabled/gradido.conf
|
rm /etc/nginx/sites-enabled/gradido.conf
|
||||||
sudo ln -s /etc/nginx/sites-available/update-page.conf /etc/nginx/sites-enabled/
|
ln -s /etc/nginx/sites-available/update-page.conf /etc/nginx/sites-enabled/
|
||||||
sudo /etc/init.d/nginx restart
|
sudo /etc/init.d/nginx restart
|
||||||
|
|
||||||
|
|
||||||
@ -49,16 +50,32 @@ git checkout $BRANCH
|
|||||||
git pull
|
git pull
|
||||||
export BUILD_COMMIT="$(git rev-parse HEAD)"
|
export BUILD_COMMIT="$(git rev-parse HEAD)"
|
||||||
|
|
||||||
|
# Generate gradido.conf from template
|
||||||
|
case "$NGINX_SSL" in
|
||||||
|
true) TEMPLATE_FILE="gradido.conf.ssl.template" ;;
|
||||||
|
*) TEMPLATE_FILE="gradido.conf.template" ;;
|
||||||
|
esac
|
||||||
|
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $NGINX_CONFIG_DIR/$TEMPLATE_FILE > $NGINX_CONFIG_DIR/gradido.conf
|
||||||
|
|
||||||
|
# Generate update-page.conf from template
|
||||||
|
case "$NGINX_SSL" in
|
||||||
|
true) TEMPLATE_FILE="update-page.conf.ssl.template" ;;
|
||||||
|
*) TEMPLATE_FILE="update-page.conf.template" ;;
|
||||||
|
esac
|
||||||
|
envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $NGINX_CONFIG_DIR/$TEMPLATE_FILE > $NGINX_CONFIG_DIR/update-page.conf
|
||||||
|
|
||||||
# Install & build database
|
# Install & build database
|
||||||
echo 'Updating database<br>' >> $UPDATE_HTML
|
echo 'Updating database<br>' >> $UPDATE_HTML
|
||||||
cd $PROJECT_ROOT/database
|
cd $PROJECT_ROOT/database
|
||||||
yarn install
|
yarn install
|
||||||
yarn build
|
yarn build
|
||||||
# TODO only in staging!
|
if [ "$DEPLOY_SEED_DATA" = "true" ]; then
|
||||||
yarn dev_up
|
yarn dev_up
|
||||||
# TODO only in staging!
|
yarn dev_reset
|
||||||
yarn dev_reset
|
yarn seed
|
||||||
yarn seed
|
else
|
||||||
|
yarn up
|
||||||
|
fi
|
||||||
|
|
||||||
# Install & build backend
|
# Install & build backend
|
||||||
echo 'Updating backend<br>' >> $UPDATE_HTML
|
echo 'Updating backend<br>' >> $UPDATE_HTML
|
||||||
@ -89,8 +106,8 @@ pm2 save
|
|||||||
|
|
||||||
# let nginx showing gradido
|
# let nginx showing gradido
|
||||||
echo 'Configuring nginx to serve gradido again<br>' >> $UPDATE_HTML
|
echo 'Configuring nginx to serve gradido again<br>' >> $UPDATE_HTML
|
||||||
sudo ln -s /etc/nginx/sites-available/gradido.conf /etc/nginx/sites-enabled/
|
ln -s /etc/nginx/sites-available/gradido.conf /etc/nginx/sites-enabled/
|
||||||
sudo rm /etc/nginx/sites-enabled/update-page.conf
|
rm /etc/nginx/sites-enabled/update-page.conf
|
||||||
sudo /etc/init.d/nginx restart
|
sudo /etc/init.d/nginx restart
|
||||||
|
|
||||||
#release lock
|
#release lock
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user