34 lines
1 KiB
Bash
34 lines
1 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
set -e
|
||
|
|
|
||
|
|
echo "=== 1. Target Directory Setup ==="
|
||
|
|
sudo mkdir -p /home/ubuntu/getcito/logs
|
||
|
|
sudo chown -R ubuntu:ubuntu /home/ubuntu/getcito
|
||
|
|
tar -xzf /tmp/app.tar.gz -C /home/ubuntu/getcito
|
||
|
|
|
||
|
|
cd /home/ubuntu/getcito
|
||
|
|
|
||
|
|
echo "=== 2. Environment Configuration ==="
|
||
|
|
if [ ! -f .env ]; then
|
||
|
|
cp .env.example .env
|
||
|
|
fi
|
||
|
|
cp .env apps/web/.env
|
||
|
|
|
||
|
|
echo "=== 3. Install Dependencies & Build ==="
|
||
|
|
export PATH=/opt/node24/bin:/usr/local/bin:/usr/bin:/bin
|
||
|
|
pnpm install --no-frozen-lockfile
|
||
|
|
pnpm build
|
||
|
|
|
||
|
|
echo "=== 4. Systemd Service Deployment ==="
|
||
|
|
sudo cp /tmp/getcito.service /etc/systemd/system/getcito.service
|
||
|
|
sudo cp /tmp/getcito-worker.service /etc/systemd/system/getcito-worker.service
|
||
|
|
sudo systemctl daemon-reload
|
||
|
|
sudo systemctl enable getcito.service getcito-worker.service
|
||
|
|
sudo systemctl restart getcito.service getcito-worker.service
|
||
|
|
|
||
|
|
echo "=== 5. Reload Nginx ==="
|
||
|
|
sudo nginx -t && sudo systemctl reload nginx
|
||
|
|
|
||
|
|
rm -f /tmp/app.tar.gz /tmp/getcito.service /tmp/getcito-worker.service
|
||
|
|
echo "GetCito deployed successfully to https://seo.tradhox.com!"
|