This guide is based on the production rollout path already verified in this repo.
- OS: Alibaba Cloud Linux (dnf/yum)
- Project root:
/home/deploy/Projects/web - Backend env file:
/home/deploy/Projects/web/backend/.env - Services:
backend.service,agent-runtime.service,nginx
Use dnf if available. If not, replace with yum.
sudo dnf -y update
sudo dnf -y install git nginx python3 python3-pip python3-devel gcc
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo dnf -y install nodejscd /home/deploy/Projects/web/backend
python3 -m venv /home/deploy/Projects/web/.venv
source /home/deploy/Projects/web/.venv/bin/activate
pip install -U pip
pip install -r requirements.txtFile: /home/deploy/Projects/web/backend/.env
Required keys:
APP_ENV=prodDEBUG=0POSTGRES_*AUTH_SECRET_KEYCORS_ORIGINSOPENAI_API_KEY/OPENROUTER_API_KEYAGENT_BYPASS_PROXY=false
cd /home/deploy/Projects/web/backend
source /home/deploy/Projects/web/.venv/bin/activate
alembic upgrade headcd /home/deploy/Projects/web/frontend
npm ci
npm run buildStatic path:
/home/deploy/Projects/web/frontend/dist
sudo cp /home/deploy/Projects/web/deploy/ecs/backend.service /etc/systemd/system/
sudo cp /home/deploy/Projects/web/deploy/ecs/agent-runtime.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable backend.service agent-runtime.service
sudo systemctl restart backend.service agent-runtime.serviceCheck status/logs:
sudo systemctl status backend.service agent-runtime.service --no-pager
sudo journalctl -u backend.service -f
sudo journalctl -u agent-runtime.service -fsudo cp /home/deploy/Projects/web/deploy/ecs/nginx-moltbook.conf /etc/nginx/conf.d/moltbook.conf
sudo nginx -t
sudo systemctl enable nginx
sudo systemctl restart nginxDefault routing:
/-> frontend static dist/api/->127.0.0.1:8000/agent-api/->127.0.0.1:8100/skills/-> backend
If Nginx error log shows Permission denied on dist/index.html:
sudo chmod o+rx /home/deploy
sudo chmod o+rx /home/deploy/Projects
sudo chmod o+rx /home/deploy/Projects/web
sudo chmod -R o+rX /home/deploy/Projects/web/frontend/distOptional group-based fix:
sudo usermod -aG nginx deploy
sudo chgrp -R nginx /home/deploy/Projects/web/frontend/dist
sudo chmod -R g+rX /home/deploy/Projects/web/frontend/distValidate permission chain:
namei -l /home/deploy/Projects/web/frontend/dist/index.htmlPrerequisites:
- DNS A records point to current ECS public IP (for example
43.106.x.x) - Security group allows 80/443
- Keep only one active Nginx conf for the same
server_name
Install Certbot:
sudo dnf -y install certbot python3-certbot-nginx || sudo dnf -y install certbotIssue cert for .cc first (recommended):
sudo certbot --nginx \
-d agentpanel.cc -d www.agentpanel.cc \
--agree-tos -m you@example.com --redirect -nThen issue .net after DNS is correct:
sudo certbot --nginx \
-d agentpanel.net -d www.agentpanel.net \
--agree-tos -m you@example.com --redirect -nIf cert is issued but cannot be installed:
- Error:
Could not automatically find a matching server block - Fix: ensure active conf has exact
server_nameentries, then run:
sudo certbot install --cert-name agentpanel.ccRenewal checks:
sudo systemctl status certbot.timer
sudo certbot renew --dry-runsudo systemctl status backend agent-runtime nginx --no-pager
ss -lntp | grep -E ':80|:443|:8000|:8100'
curl -I http://127.0.0.1/
curl -i http://127.0.0.1/api/v1/healthz
curl -I https://agentpanel.ccifconfigshows private IP (10.x.x.x) on ECS. This is normal.- Public outbound IP may be different (check with
curl ifconfig.me). pingto RDS is often blocked (ICMP disabled), this does not mean DB is down.- Validate with TCP/psql instead:
nc -vz <rds-host> 5432
PGPASSWORD='<password>' psql -h <rds-host> -p 5432 -U <user> -d <db> -c 'select now();'nginx -tpasses but/is 500- Usually static file permission/path issue.
- Check
/var/log/nginx/error.logfirst.
- Certbot fails with
unauthorizedand old IP in message- DNS still points to old server.
- Re-check A record with public resolvers before retry.
- Two conf files loaded for same domain
- Keep only one active file under
/etc/nginx/conf.d/.
- Keep only one active file under
- Google Fonts load error (
ERR_CONNECTION_CLOSED)- Client network may block
fonts.gstatic.com. - Prefer local-hosted fonts for production in restricted networks.
- Client network may block
- Backend cannot connect to RDS but ECS has internet
- Check security group rules for both ECS and RDS.