Last active
November 1, 2025 17:09
-
-
Save apoorvanand/c56a01ab55e2afc22d7dc54486e38511 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| # =========================================== | |
| # CONFIGURATION | |
| # =========================================== | |
| POSTIZ_DOMAIN="social.thenotary.app" | |
| GROWCHIEF_DOMAIN="linkedin.thenotary.app" | |
| POSTIZ_DIR="/opt/postiz" | |
| GROWCHIEF_DIR="/opt/growchief" | |
| # =========================================== | |
| # STEP 1: SYSTEM UPDATE & DEPENDENCIES | |
| # =========================================== | |
| echo ">>> Updating system..." | |
| sudo apt update -y && sudo apt upgrade -y | |
| sudo apt install -y ca-certificates curl gnupg lsb-release git nginx | |
| # =========================================== | |
| # STEP 2: INSTALL DOCKER ENGINE | |
| # =========================================== | |
| if ! command -v docker &> /dev/null; then | |
| echo ">>> Installing Docker..." | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ | |
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ | |
| https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt update -y | |
| sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
| sudo systemctl enable docker | |
| sudo systemctl start docker | |
| else | |
| echo ">>> Docker already installed." | |
| fi | |
| # =========================================== | |
| # STEP 3: INSTALL DOCKER-COMPOSE | |
| # =========================================== | |
| if ! command -v docker-compose &> /dev/null; then | |
| echo ">>> Installing Docker Compose..." | |
| sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" \ | |
| -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| else | |
| echo ">>> Docker Compose already installed." | |
| fi | |
| # =========================================== | |
| # STEP 4: DEPLOY POSTIZ | |
| # =========================================== | |
| echo ">>> Setting up Postiz..." | |
| sudo mkdir -p "$POSTIZ_DIR" | |
| cd "$POSTIZ_DIR" | |
| if [ ! -f "docker-compose.yml" ]; then | |
| echo ">>> Downloading Postiz docker-compose.yml..." | |
| curl -fsSL https://raw.githubusercontent.com/gitroomhq/postiz-app/refs/heads/main/docker-compose.dev.yaml | |
| fi | |
| sudo docker-compose pull | |
| sudo docker-compose up -d | |
| # =========================================== | |
| # STEP 5: DEPLOY GROWCHIEF | |
| # =========================================== | |
| echo ">>> Setting up GrowChief..." | |
| sudo mkdir -p "$GROWCHIEF_DIR" | |
| cd "$GROWCHIEF_DIR" | |
| if [ ! -f "docker-compose.yml" ]; then | |
| echo ">>> Downloading GrowChief docker-compose.yml..." | |
| curl -fsSL https://raw.githubusercontent.com/growchief/growchief/refs/heads/main/docker-compose.yml -o docker-compose.yml | |
| fi | |
| sudo docker-compose pull | |
| sudo docker-compose up -d | |
| # =========================================== | |
| # STEP 6: CONFIGURE NGINX REVERSE PROXY | |
| # =========================================== | |
| echo ">>> Configuring Nginx reverse proxy..." | |
| sudo tee /etc/nginx/sites-available/thenotary_apps.conf > /dev/null <<EOF | |
| server { | |
| listen 80; | |
| server_name $POSTIZ_DOMAIN; | |
| location / { | |
| proxy_pass http://127.0.0.1:3000; # Adjust Postiz port if needed | |
| proxy_set_header Host \$host; | |
| proxy_set_header X-Real-IP \$remote_addr; | |
| proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; | |
| proxy_set_header X-Forwarded-Proto \$scheme; | |
| } | |
| } | |
| server { | |
| listen 80; | |
| server_name $GROWCHIEF_DOMAIN; | |
| location / { | |
| proxy_pass http://127.0.0.1:4000; # Adjust GrowChief port if needed | |
| proxy_set_header Host \$host; | |
| proxy_set_header X-Real-IP \$remote_addr; | |
| proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; | |
| proxy_set_header X-Forwarded-Proto \$scheme; | |
| } | |
| } | |
| EOF | |
| sudo ln -sf /etc/nginx/sites-available/thenotary_apps.conf /etc/nginx/sites-enabled/ | |
| sudo nginx -t | |
| sudo systemctl restart nginx | |
| # =========================================== | |
| # STEP 7: PRINT SUMMARY | |
| # =========================================== | |
| echo ">>> Setup complete!" | |
| echo "Access Postiz: http://$POSTIZ_DOMAIN" | |
| echo "Access GrowChief: http://$GROWCHIEF_DOMAIN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment