summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md67
1 files changed, 33 insertions, 34 deletions
diff --git a/README.md b/README.md
index 8125bc9..a2253c1 100644
--- a/README.md
+++ b/README.md
@@ -28,8 +28,8 @@ go install ./cmd/deploy
28### 1. Initialize Your VPS (One-time) 28### 1. Initialize Your VPS (One-time)
29 29
30```bash 30```bash
31# Initialize a fresh VPS 31# Initialize a fresh VPS (this sets it as the default host)
32deploy init --host user@your-vps-ip 32deploy host init user@your-vps-ip
33``` 33```
34 34
35This will: 35This will:
@@ -45,15 +45,15 @@ This will:
45GOOS=linux GOARCH=amd64 go build -o myapp 45GOOS=linux GOARCH=amd64 go build -o myapp
46 46
47# Deploy it 47# Deploy it
48deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com 48deploy --binary ./myapp --domain api.example.com
49 49
50# With environment variables 50# With environment variables
51deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com \ 51deploy --binary ./myapp --domain api.example.com \
52 --env DB_HOST=localhost \ 52 --env DB_HOST=localhost \
53 --env API_KEY=secret 53 --env API_KEY=secret
54 54
55# Or from an env file 55# Or from an env file
56deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com \ 56deploy --binary ./myapp --domain api.example.com \
57 --env-file .env.production 57 --env-file .env.production
58``` 58```
59 59
@@ -64,7 +64,7 @@ deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com \
64npm run build 64npm run build
65 65
66# Deploy it 66# Deploy it
67deploy deploy --host user@vps-ip --static --dir ./dist --domain example.com 67deploy --static --dir ./dist --domain example.com
68``` 68```
69 69
70## App Requirements 70## App Requirements
@@ -106,72 +106,72 @@ func main() {
106 106
107## Commands 107## Commands
108 108
109### Initialize VPS 109### Host Management
110
110```bash 111```bash
111deploy init --host user@vps-ip 112# Initialize a fresh VPS (one-time setup, sets as default)
113deploy host init user@vps-ip
114
115# Update system packages (apt update && apt upgrade)
116deploy host update
117
118# Check host status
119deploy host status
120
121# SSH into the host
122deploy host ssh
112``` 123```
113 124
114### Deploy App/Site 125### Deploy App/Site
115```bash 126```bash
116# Go app 127# Go app
117deploy deploy --host user@vps-ip --binary ./myapp --domain api.example.com 128deploy --binary ./myapp --domain api.example.com
118 129
119# Static site 130# Static site
120deploy deploy --host user@vps-ip --static --dir ./dist --domain example.com 131deploy --static --dir ./dist --domain example.com
121 132
122# Custom name (defaults to binary/directory name) 133# Custom name (defaults to binary/directory name)
123deploy deploy --host user@vps-ip --name myapi --binary ./myapp --domain api.example.com 134deploy --name myapi --binary ./myapp --domain api.example.com
124``` 135```
125 136
126### List Deployments 137### List Deployments
127```bash 138```bash
128deploy list --host user@vps-ip 139deploy list
129``` 140```
130 141
131### Manage Deployments 142### Manage Deployments
132```bash 143```bash
133# View logs 144# View logs
134deploy logs myapp --host user@vps-ip 145deploy logs myapp
135 146
136# View status 147# View status
137deploy status myapp --host user@vps-ip 148deploy status myapp
138 149
139# Restart app 150# Restart app
140deploy restart myapp --host user@vps-ip 151deploy restart myapp
141 152
142# Remove deployment 153# Remove deployment
143deploy remove myapp --host user@vps-ip 154deploy remove myapp
144``` 155```
145 156
146### Environment Variables 157### Environment Variables
147```bash 158```bash
148# View current env vars (secrets are masked) 159# View current env vars (secrets are masked)
149deploy env myapi --host user@vps-ip 160deploy env list myapi
150 161
151# Set env vars 162# Set env vars
152deploy env myapi --host user@vps-ip --set DB_HOST=localhost --set API_KEY=secret 163deploy env set myapi DB_HOST=localhost API_KEY=secret
153 164
154# Load from file 165# Load from file
155deploy env myapi --host user@vps-ip --file .env.production 166deploy env set myapi -f .env.production
156 167
157# Unset env var 168# Unset env var
158deploy env myapi --host user@vps-ip --unset API_KEY 169deploy env unset myapi API_KEY
159``` 170```
160 171
161## Configuration 172## Configuration
162 173
163Create `~/.config/deploy/config` to avoid typing `--host` every time: 174The host you initialize becomes the default, so you don't need to specify `--host` for every command. The default host is stored in `~/.config/deploy/state.json`.
164
165```
166host: user@your-vps-ip
167```
168
169Then you can omit the `--host` flag:
170
171```bash
172deploy list
173deploy deploy --binary ./myapp --domain api.example.com
174```
175 175
176## How It Works 176## How It Works
177 177
@@ -186,8 +186,7 @@ deploy deploy --binary ./myapp --domain api.example.com
186 186
187### On Laptop 187### On Laptop
188``` 188```
189~/.config/deploy/state.json # All deployment state 189~/.config/deploy/state.json # All deployment state (including default host)
190~/.config/deploy/config # Optional: default host
191``` 190```
192 191
193### On VPS 192### On VPS