Browse Source

Merge pull request #9019 from nocodb/chore/upstall

Corrections in setup script
pull/9037/head
Pranav C 4 months ago committed by GitHub
parent
commit
cdb4beacf9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      docker-compose/setup-script/noco.sh

23
docker-compose/setup-script/noco.sh

@ -15,6 +15,8 @@ BOLD='\033[1m'
NC='\033[0m' NC='\033[0m'
NOCO_HOME="./nocodb" NOCO_HOME="./nocodb"
# Get the current working directory
CURRENT_PATH=$(pwd)
# ***************** GLOBAL VARIABLES END *********************************** # ***************** GLOBAL VARIABLES END ***********************************
# ****************************************************************************** # ******************************************************************************
@ -359,6 +361,7 @@ if [ "$NOCO_FOUND" = true ]; then
cd /tmp || exit 1 cd /tmp || exit 1
rm -rf "$NOCO_HOME" rm -rf "$NOCO_HOME"
cd "$CURRENT_PATH" || exit 1
mkdir -p "$NOCO_HOME" mkdir -p "$NOCO_HOME"
cd "$NOCO_HOME" || exit 1 cd "$NOCO_HOME" || exit 1
fi fi
@ -573,6 +576,8 @@ services:
nginx: nginx:
image: nginx:latest image: nginx:latest
labels:
com.nocodb.service: "nginx"
volumes: volumes:
- ./nginx:/etc/nginx/conf.d - ./nginx:/etc/nginx/conf.d
EOF EOF
@ -603,7 +608,23 @@ if [ "$SSL_ENABLED" = 'y' ] || [ "$SSL_ENABLED" = 'Y' ]; then
- ./letsencrypt:/etc/letsencrypt - ./letsencrypt:/etc/letsencrypt
- letsencrypt-lib:/var/lib/letsencrypt - letsencrypt-lib:/var/lib/letsencrypt
- webroot:/var/www/certbot - webroot:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait \$\${!}; done;'" entrypoint: |
/bin/sh -c '
apk add docker-cli || { echo "Failed to install Docker CLI"; exit 1; };
trap exit TERM;
while :; do
OUTPUT=\$\$(certbot renew 2>&1);
echo "\$\$OUTPUT";
if echo "\$\$OUTPUT" | grep -q "No renewals were attempted"; then
echo "No certificates were renewed.";
else
echo "Certificates renewed. Reloading nginx...";
sleep 5;
CONTAINER_NAME=\$\$(docker ps --format "{{.Names}}" --filter "com.nocodb.service=nginx" | grep "nginx") || { echo "Failed to find nginx container"; exit 1; };
docker exec \$\$CONTAINER_NAME nginx -s reload || { echo "Failed to reload nginx"; exit 1; };
fi;
sleep 12h & wait \$\${!};
done;'
depends_on: depends_on:
- nginx - nginx
restart: unless-stopped restart: unless-stopped

Loading…
Cancel
Save