Scaleway Deployment by clementwalter/claudine
npx skills add https://github.com/clementwalter/claudine --skill 'Scaleway Deployment'用户不懂 DevOps。用户也不想知道 DevOps。处理一切事务。
始终询问:"你想怎么称呼这个服务器?"
此名称将用于:
ssh root@<名称>)检查 Scaleway CLI 是否已配置:scw config dump
如果未配置,逐个询问凭证:
问题 1:Scaleway 账户
我需要连接到你的 Scaleway 账户。以下是获取密钥的方法:
- 访问 https://console.scaleway.com/iam/api-keys
- 点击"生成 API 密钥"
- 复制"访问密钥"(以"SCW"开头)
- 复制"密钥"(长随机字符串)
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
将它们粘贴在这里(我会将它们安全地存储在 GitHub 中,你以后不再需要它们):
访问密钥: 密钥:
问题 2:Scaleway 项目
现在我需要你的项目 ID:
- 访问 https://console.scaleway.com/project/settings
- 复制"项目 ID"(格式类似:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
将其粘贴在这里:
就这样。 运行 uv run .claude/skills/scaleway-dev/scripts/setup.py 以:
告诉用户:"正在设置你的服务器...这大约需要 3 分钟。"
创建服务器后:
ssh root@<IP> << 'EOF'
# 创建具有 sudo 和 docker 访问权限的用户
useradd -m -s /bin/zsh <用户名>
echo "<用户名> ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/<用户名>
usermod -aG sudo,docker <用户名>
# 复制 SSH 密钥
mkdir -p /home/<用户名>/.ssh
cp /root/.ssh/authorized_keys /home/<用户名>/.ssh/
chown -R <用户名>:<用户名> /home/<用户名>/.ssh
chmod 700 /home/<用户名>/.ssh
chmod 600 /home/<用户名>/.ssh/authorized_keys
EOF
使用本地用户名(来自 whoami)作为 <用户名>。
~/.ssh/config(使用非 root 用户):Host <名称>
HostName <IP地址>
User <用户名>
IdentityFile ~/.ssh/id_ed25519
缓存 IP:echo "<IP>" > ~/.cache/scaleway-deploy/<名称>_ip
同步用户的 shell 环境(使服务器感觉像本地一样):
# 安装 zsh(首先以 root 身份,在用户设置之前)
ssh root@<IP> "apt-get install -y -qq zsh git"
# 为用户安装 oh-my-zsh
ssh <名称> 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended'
# 安装常用插件
ssh <名称> 'git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions; git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'
# 复制用户的配置
scp ~/.zshrc <名称>:~/.zshrc
scp ~/.gitconfig <名称>:~/.gitconfig
# 重要:使 .zshrc 可移植(修复硬编码路径和缺失的工具)
ssh <名称> << 'FIXZSH'
# 修复硬编码的主目录路径
sed -i "s|/Users/[^/]*/|$HOME/|g" ~/.zshrc
sed -i "s|/opt/homebrew/[^\"]*|$HOME/.local/bin|g" ~/.zshrc
# 用存在性检查包装可选工具
sed -i 's|^\. \$HOME/.asdf/asdf.sh|[ -f "$HOME/.asdf/asdf.sh" ] \&\& . "$HOME/.asdf/asdf.sh"|' ~/.zshrc
sed -i 's|^\. "\$HOME/.atuin/bin/env"|[ -f "$HOME/.atuin/bin/env" ] \&\& . "$HOME/.atuin/bin/env"|' ~/.zshrc
sed -i 's|^eval "\$(atuin init zsh)"|command -v atuin \&>/dev/null \&\& eval "$(atuin init zsh)"|' ~/.zshrc
sed -i 's|^eval "\$(scw autocomplete script shell=zsh)"|command -v scw \&>/dev/null \&\& eval "$(scw autocomplete script shell=zsh)"|' ~/.zshrc
# 用存在性检查包装 nvm/load-nvmrc(如果未安装 nvm 则注释掉)
if ! command -v nvm &>/dev/null; then
sed -i '/^load-nvmrc() {/,/^}$/s/^/# /' ~/.zshrc
sed -i 's/^add-zsh-hook chpwd load-nvmrc/# add-zsh-hook chpwd load-nvmrc/' ~/.zshrc
sed -i '/^load-nvmrc$/s/^/# /' ~/.zshrc
fi
FIXZSH
ssh <名称>"自动运行部署。告诉用户:
"正在部署你的应用...完成!你的应用已上线,地址为:http://(或 http://IP)"
| 脚本 | 用途 |
|---|---|
scripts/setup.py | 一次性设置,将密钥存储在 GitHub 中 |
scripts/deploy.py | 部署应用(使用 --auto 标志进行静默模式) |
scripts/status.py | 检查一切是否正常运行 |
scripts/logs.py | 如果出现问题,获取应用日志 |
scripts/destroy.py | 销毁一切(务必先询问用户确认!) |
"完成!你的应用已上线,地址为 http://X.X.X.X"
"出了点问题。让我检查一下... [运行 logs.py,诊断,如果可能自动修复 > > > > > >]"
简要回答,然后主动提出处理:
"那是[简要解释]。需要我直接为你设置吗?"
所有这些都自动发生,用户永远看不到:
将这些密钥存储在用户的 GitHub 仓库中(仅一次):
| 密钥名称 | 值 |
|---|---|
SCW_ACCESS_KEY | Scaleway 访问密钥 |
SCW_SECRET_KEY | Scaleway 密钥 |
SCW_PROJECT_ID | Scaleway 项目 ID |
SCW_SSH_PRIVATE_KEY | 自动生成的 SSH 私钥 |
SCW_SSH_PUBLIC_KEY | 自动生成的 SSH 公钥 |
SCW_SERVER_IP | 服务器 IP(配置后) |
# 检查设置是否完成
uv run .claude/skills/scaleway-dev/scripts/setup.py --check
# 运行完整设置(交互式,询问凭证)
uv run .claude/skills/scaleway-dev/scripts/setup.py
# 部署(静默模式)
uv run .claude/skills/scaleway-dev/scripts/deploy.py --auto
# 检查状态
uv run .claude/skills/scaleway-dev/scripts/status.py
# 查看日志
uv run .claude/skills/scaleway-dev/scripts/logs.py --tail 50
# 销毁一切(务必先询问用户!)
uv run .claude/skills/scaleway-dev/scripts/destroy.py
有关何时使用无服务器容器与 VPS,请参见上面的部署策略部分。快速参考:scw container container create 和 scw container container deploy。
每周安装次数
0
仓库
GitHub 星标数
1
首次出现时间
1970年1月1日
安全审计
The user doesn't know DevOps. The user doesn't WANT to know DevOps. Handle everything.
Always ask: "What do you want to call this server?"
This name will be used for:
ssh root@<name>)Check if Scaleway CLI is configured: scw config dump
If not configured, ask for credentials ONE AT A TIME:
Question 1: Scaleway Account
I need to connect to your Scaleway account. Here's how to get the keys:
- Go to https://console.scaleway.com/iam/api-keys
- Click "Generate API Key"
- Copy the "Access Key" (starts with "SCW")
- Copy the "Secret Key" (long random string)
Paste them here (I'll store them securely in GitHub, you won't need them again):
Access Key: Secret Key:
Question 2: Scaleway Project
Now I need your Project ID:
- Go to https://console.scaleway.com/project/settings
- Copy the "Project ID" (looks like: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
Paste it here:
That's it. Run uv run .claude/skills/scaleway-dev/scripts/setup.py to:
Tell the user: "Setting up your server... This takes about 3 minutes."
After creating the server:
ssh root@<IP> << 'EOF'
# Create user with sudo and docker access
useradd -m -s /bin/zsh <username>
echo "<username> ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/<username>
usermod -aG sudo,docker <username>
# Copy SSH keys
mkdir -p /home/<username>/.ssh
cp /root/.ssh/authorized_keys /home/<username>/.ssh/
chown -R <username>:<username> /home/<username>/.ssh
chmod 700 /home/<username>/.ssh
chmod 600 /home/<username>/.ssh/authorized_keys
EOF
Use the local username (from whoami) as <username>.
~/.ssh/config (with non-root user):Host <name>
HostName <IP_ADDRESS>
User <username>
IdentityFile ~/.ssh/id_ed25519
3. Cache the IP: echo "<IP>" > ~/.cache/scaleway-deploy/<name>_ip
# Install zsh (as root first, before user setup)
ssh root@<IP> "apt-get install -y -qq zsh git"
# Install oh-my-zsh for the user
ssh <name> 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended'
# Install common plugins
ssh <name> 'git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions; git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'
# Copy user's configs
scp ~/.zshrc <name>:~/.zshrc
scp ~/.gitconfig <name>:~/.gitconfig
# IMPORTANT: Make .zshrc portable (fix hardcoded paths and missing tools)
ssh <name> << 'FIXZSH'
# Fix hardcoded home paths
sed -i "s|/Users/[^/]*/|$HOME/|g" ~/.zshrc
sed -i "s|/opt/homebrew/[^\"]*|$HOME/.local/bin|g" ~/.zshrc
# Wrap optional tools in existence checks
sed -i 's|^\. \$HOME/.asdf/asdf.sh|[ -f "$HOME/.asdf/asdf.sh" ] \&\& . "$HOME/.asdf/asdf.sh"|' ~/.zshrc
sed -i 's|^\. "\$HOME/.atuin/bin/env"|[ -f "$HOME/.atuin/bin/env" ] \&\& . "$HOME/.atuin/bin/env"|' ~/.zshrc
sed -i 's|^eval "\$(atuin init zsh)"|command -v atuin \&>/dev/null \&\& eval "$(atuin init zsh)"|' ~/.zshrc
sed -i 's|^eval "\$(scw autocomplete script shell=zsh)"|command -v scw \&>/dev/null \&\& eval "$(scw autocomplete script shell=zsh)"|' ~/.zshrc
# Wrap nvm/load-nvmrc in existence check (comment out if nvm not installed)
if ! command -v nvm &>/dev/null; then
sed -i '/^load-nvmrc() {/,/^}$/s/^/# /' ~/.zshrc
sed -i 's/^add-zsh-hook chpwd load-nvmrc/# add-zsh-hook chpwd load-nvmrc/' ~/.zshrc
sed -i '/^load-nvmrc$/s/^/# /' ~/.zshrc
fi
FIXZSH
6. Tell user: "Done! Connect with:ssh <name>"
Run deployment automatically. Tell the user:
"Deploying your app... Done! Your app is live at: http:// (or http://IP)"
| Script | Purpose |
|---|---|
scripts/setup.py | One-time setup, stores secrets in GitHub |
scripts/deploy.py | Deploy app (use --auto flag for silent mode) |
scripts/status.py | Check if everything is running |
scripts/logs.py | Get app logs if something is wrong |
scripts/destroy.py | Tear down everything (ask for confirmation!) |
"Done! Your app is live at http://X.X.X.X"
"Something went wrong. Let me check... [run logs.py, diagnose, fix > > > > > >
automatically if possible]"
Answer briefly, then offer to just handle it:
"That's [brief explanation]. Want me to just set it up for you?"
All this happens automatically, user never sees it:
Store these secrets in the user's GitHub repo (one time only):
| Secret Name | Value |
|---|---|
SCW_ACCESS_KEY | Scaleway access key |
SCW_SECRET_KEY | Scaleway secret key |
SCW_PROJECT_ID | Scaleway project ID |
SCW_SSH_PRIVATE_KEY | Auto-generated SSH private key |
SCW_SSH_PUBLIC_KEY | Auto-generated SSH public key |
SCW_SERVER_IP | Server IP (after provisioning) |
# Check if setup is done
uv run .claude/skills/scaleway-dev/scripts/setup.py --check
# Run full setup (interactive, asks for credentials)
uv run .claude/skills/scaleway-dev/scripts/setup.py
# Deploy (silent mode)
uv run .claude/skills/scaleway-dev/scripts/deploy.py --auto
# Check status
uv run .claude/skills/scaleway-dev/scripts/status.py
# View logs
uv run .claude/skills/scaleway-dev/scripts/logs.py --tail 50
# Destroy everything (ALWAYS ask user first!)
uv run .claude/skills/scaleway-dev/scripts/destroy.py
See the deployment strategy section above for when to use Serverless Containers vs VPS. Quick reference: scw container container create and scw container container deploy.
Weekly Installs
0
Repository
GitHub Stars
1
First Seen
Jan 1, 1970
Security Audits
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
114,200 周安装