enter-services

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Requirements

前提条件

Before using this skill, ensure you have:
  • SSH keys: Configured via GitHub secrets (see workflow)
  • sops:
    brew install sops
    (for decrypting secrets)
  • Wrangler:
    npm install -g wrangler
  • Node.js:
    brew install node
Must run from the
pollinations
repo root.

使用本技能前,请确保你已具备以下内容:
  • SSH密钥:通过GitHub secrets配置(详见工作流)
  • sops:执行
    brew install sops
    (用于解密密钥)
  • Wrangler:执行
    npm install -g wrangler
  • Node.js:执行
    brew install node
必须从
pollinations
仓库根目录运行相关命令。

Architecture Overview

架构概览

EnvironmentGateway (Cloudflare Worker)Text/Image Services (EC2)
Production
enter.pollinations.ai
3.80.56.235
(ports 16384/16385)
Staging
staging.enter.pollinations.ai
44.222.254.250
(ports 16384/16385)

环境网关(Cloudflare Worker)文本/图像服务(EC2)
生产环境
enter.pollinations.ai
3.80.56.235
(端口16384/16385)
预发布环境
staging.enter.pollinations.ai
44.222.254.250
(端口16384/16385)

SSH Configuration

SSH配置

Add to
~/.ssh/config
:
undefined
将以下内容添加到
~/.ssh/config
undefined

Production instance

Production instance

Host enter-services HostName 3.80.56.235 User ubuntu IdentityFile ~/.ssh/enter-services-shared-key
Host enter-services HostName 3.80.56.235 User ubuntu IdentityFile ~/.ssh/enter-services-shared-key

Staging instance

Staging instance

Host enter-services-staging HostName 44.222.254.250 User ubuntu IdentityFile ~/.ssh/enter-services-staging-key

---
Host enter-services-staging HostName 44.222.254.250 User ubuntu IdentityFile ~/.ssh/enter-services-staging-key

---

Quick Commands

快速命令

Production

生产环境

bash
undefined
bash
undefined

Service status

服务状态

ssh enter-services "sudo systemctl status text-pollinations.service image-pollinations.service"
ssh enter-services "sudo systemctl status text-pollinations.service image-pollinations.service"

View logs (real-time)

查看实时日志

ssh enter-services "sudo journalctl -u text-pollinations.service -f" ssh enter-services "sudo journalctl -u image-pollinations.service -f"
ssh enter-services "sudo journalctl -u text-pollinations.service -f" ssh enter-services "sudo journalctl -u image-pollinations.service -f"

Restart services

重启服务

ssh enter-services "sudo systemctl restart text-pollinations.service image-pollinations.service"
ssh enter-services "sudo systemctl restart text-pollinations.service image-pollinations.service"

Recent errors

最近的错误日志

ssh enter-services "sudo journalctl -u text-pollinations.service -p err -n 20"
undefined
ssh enter-services "sudo journalctl -u text-pollinations.service -p err -n 20"
undefined

Staging

预发布环境

bash
undefined
bash
undefined

Service status

服务状态

ssh enter-services-staging "sudo systemctl status text-pollinations.service image-pollinations.service"
ssh enter-services-staging "sudo systemctl status text-pollinations.service image-pollinations.service"

View logs

查看日志

ssh enter-services-staging "sudo journalctl -u text-pollinations.service -f"
ssh enter-services-staging "sudo journalctl -u text-pollinations.service -f"

Restart

重启服务

ssh enter-services-staging "sudo systemctl restart text-pollinations.service image-pollinations.service"

---
ssh enter-services-staging "sudo systemctl restart text-pollinations.service image-pollinations.service"

---

Deploy to Production

部署到生产环境

The GitHub workflow handles production deployments automatically on push to
production
branch.
Manual deployment:
bash
undefined
推送到
production
分支时,GitHub工作流会自动处理生产环境部署。
手动部署步骤:
bash
undefined

1. SSH into production

1. 登录生产环境EC2

ssh enter-services
ssh enter-services

2. Pull and restart

2. 拉取代码并重启服务

cd /home/ubuntu/pollinations git pull origin production cd text.pollinations.ai && npm install cd ../image.pollinations.ai && npm install sudo systemctl restart text-pollinations.service image-pollinations.service

---
cd /home/ubuntu/pollinations git pull origin production cd text.pollinations.ai && npm install cd ../image.pollinations.ai && npm install sudo systemctl restart text-pollinations.service image-pollinations.service

---

Deploy to Staging

部署到预发布环境

Full Setup (New Instance)

完整配置(新实例)

bash
undefined
bash
undefined

1. SSH into the new instance

1. 登录新实例

ssh enter-services-staging
ssh enter-services-staging

2. Install build tools (if needed)

2. 安装构建工具(若需要)

sudo apt-get update && sudo apt-get install -y build-essential
sudo apt-get update && sudo apt-get install -y build-essential

3. Clone repo

3. 克隆仓库

4. Run setup script

4. 运行配置脚本

bash enter.pollinations.ai/scripts/setup-services.sh /home/ubuntu/pollinations
bash enter.pollinations.ai/scripts/setup-services.sh /home/ubuntu/pollinations

5. From your LOCAL machine - decrypt and copy env files

5. 在本地机器上 - 解密并复制环境变量文件

cd /path/to/pollinations sops --output-type dotenv -d text.pollinations.ai/secrets/env.json > /tmp/text.env sops --output-type dotenv -d image.pollinations.ai/secrets/env.json > /tmp/image.env scp /tmp/text.env enter-services-staging:/home/ubuntu/pollinations/text.pollinations.ai/.env scp /tmp/image.env enter-services-staging:/home/ubuntu/pollinations/image.pollinations.ai/.env rm /tmp/text.env /tmp/image.env
cd /path/to/pollinations sops --output-type dotenv -d text.pollinations.ai/secrets/env.json > /tmp/text.env sops --output-type dotenv -d image.pollinations.ai/secrets/env.json > /tmp/image.env scp /tmp/text.env enter-services-staging:/home/ubuntu/pollinations/text.pollinations.ai/.env scp /tmp/image.env enter-services-staging:/home/ubuntu/pollinations/image.pollinations.ai/.env rm /tmp/text.env /tmp/image.env

6. Restart services

6. 重启服务

ssh enter-services-staging "sudo systemctl restart text-pollinations.service image-pollinations.service"
undefined
ssh enter-services-staging "sudo systemctl restart text-pollinations.service image-pollinations.service"
undefined

Update Staging

更新预发布环境

bash
ssh enter-services-staging "cd /home/ubuntu/pollinations && git pull && cd text.pollinations.ai && npm install && cd ../image.pollinations.ai && npm install && sudo systemctl restart text-pollinations.service image-pollinations.service"

bash
ssh enter-services-staging "cd /home/ubuntu/pollinations && git pull && cd text.pollinations.ai && npm install && cd ../image.pollinations.ai && npm install && sudo systemctl restart text-pollinations.service image-pollinations.service"

Deploy Cloudflare Worker (enter.pollinations.ai)

部署Cloudflare Worker(enter.pollinations.ai)

bash
cd enter.pollinations.ai
bash
cd enter.pollinations.ai

Production

生产环境

npm run deploy:production
npm run deploy:production

Staging

预发布环境

npm run deploy:staging

---
npm run deploy:staging

---

Service Locations (on EC2)

服务位置(EC2上)

  • Service definitions:
    /etc/systemd/system/
  • Text service:
    /home/ubuntu/pollinations/text.pollinations.ai/
  • Image service:
    /home/ubuntu/pollinations/image.pollinations.ai/

  • 服务定义文件
    /etc/systemd/system/
  • 文本服务
    /home/ubuntu/pollinations/text.pollinations.ai/
  • 图像服务
    /home/ubuntu/pollinations/image.pollinations.ai/

Wrangler Configuration

Wrangler配置

The
wrangler.toml
contains environment configs:
EnvironmentRouteService URLs
production
enter.pollinations.ai
Production EC2
staging
staging.enter.pollinations.ai
Staging EC2
local
localhost:3000
Local dev

wrangler.toml
文件包含环境配置:
环境路由服务URL
production
enter.pollinations.ai
生产环境EC2
staging
staging.enter.pollinations.ai
预发布环境EC2
local
localhost:3000
本地开发环境

Troubleshooting

故障排查

Services won't start

服务无法启动

bash
undefined
bash
undefined

Check logs

查看日志

ssh enter-services-staging "sudo journalctl -u text-pollinations.service -n 50"
ssh enter-services-staging "sudo journalctl -u text-pollinations.service -n 50"

Check if .env exists

检查.env文件是否存在

ssh enter-services-staging "ls -la /home/ubuntu/pollinations/text.pollinations.ai/.env"
ssh enter-services-staging "ls -la /home/ubuntu/pollinations/text.pollinations.ai/.env"

Check node/npm

检查node/npm版本

ssh enter-services-staging "node -v && npm -v"
undefined
ssh enter-services-staging "node -v && npm -v"
undefined

Missing dependencies

依赖缺失

bash
ssh enter-services-staging "cd /home/ubuntu/pollinations/text.pollinations.ai && npm install"
bash
ssh enter-services-staging "cd /home/ubuntu/pollinations/text.pollinations.ai && npm install"

Need build tools

需要安装构建工具

bash
ssh enter-services-staging "sudo apt-get install -y build-essential"

bash
ssh enter-services-staging "sudo apt-get install -y build-essential"

Notes

注意事项

  • Production deploys on push to
    production
    branch
  • Staging deploys on push to
    staging
    branch
  • Always test on staging before merging to production
  • The Cloudflare Worker (enter.pollinations.ai) routes to EC2 services
  • Text service: port 16385, Image service: port 16384
  • 推送到
    production
    分支时会自动部署生产环境
  • 推送到
    staging
    分支时会自动部署预发布环境
  • 合并到生产环境前,请务必在预发布环境测试
  • Cloudflare Worker(enter.pollinations.ai)负责将请求路由到EC2服务
  • 文本服务使用端口16385,图像服务使用端口16384