shipfe 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +103 -20
  2. package/bin/shipfe +0 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -42,44 +42,127 @@ Edit `shipfe.config.json` to configure your deployment settings:
42
42
  "host": "dev.example.com",
43
43
  "port": 22,
44
44
  "username": "deploy",
45
- "password": "your_password",
46
45
  "remote_deploy_path": "/var/www/dev",
47
46
  "delete_old": false
48
47
  }
49
48
  ],
50
- "remote_tmp": "/tmp",
51
- "sub_environments": {
52
- "admin": {
53
- "build_command": "npm run build:admin",
54
- "remote_deploy_path": "/var/www/dev/admin"
49
+ "remote_tmp": "/tmp"
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ #### Authentication Options
56
+
57
+ Each server can have its own authentication method. Shipfe tries authentication methods in this order:
58
+
59
+ 1. **Password** (if `password` is set in server config)
60
+ 2. **SSH Private Key from environment** (if `SSH_PRIVATE_KEY` env var is set)
61
+ 3. **SSH Key file** (if `key_path` is set in server config)
62
+
63
+ **Example with multiple servers using different auth methods:**
64
+
65
+ ```json
66
+ {
67
+ "environments": {
68
+ "prod": {
69
+ "build_command": "npm run build",
70
+ "local_dist_path": "./dist",
71
+ "servers": [
72
+ {
73
+ "host": "web1.prod.com",
74
+ "port": 22,
75
+ "username": "deploy",
76
+ "password": "web1_password",
77
+ "remote_deploy_path": "/var/www/prod",
78
+ "delete_old": false
79
+ },
80
+ {
81
+ "host": "web2.prod.com",
82
+ "port": 22,
83
+ "username": "deploy",
84
+ "key_path": "/home/user/.ssh/web2_key",
85
+ "remote_deploy_path": "/var/www/prod",
86
+ "delete_old": false
87
+ },
88
+ {
89
+ "host": "web3.prod.com",
90
+ "port": 22,
91
+ "username": "deploy",
92
+ "key_path": "/home/user/.ssh/web3_key",
93
+ "remote_deploy_path": "/var/www/prod",
94
+ "delete_old": false
55
95
  }
56
- }
96
+ ],
97
+ "remote_tmp": "/tmp"
57
98
  }
58
99
  }
59
100
  }
60
101
  ```
61
102
 
103
+ In this example:
104
+ - `web1.prod.com` uses password authentication
105
+ - `web2.prod.com` uses SSH key file `/home/user/.ssh/web2_key`
106
+ - `web3.prod.com` uses SSH key file `/home/user/.ssh/web3_key`
107
+
108
+ **Or use environment variable for all servers:**
109
+ ```bash
110
+ export SSH_PRIVATE_KEY="$(cat ~/.ssh/prod_key)"
111
+ shipfe deploy --profile prod
112
+ ```
113
+
62
114
  ### Authentication
63
115
 
64
- Shipfe supports multiple SSH authentication methods (tried in order):
116
+ Shipfe supports multiple SSH authentication methods for each server individually. For each server, authentication methods are tried in this order:
65
117
 
66
- 1. **Password authentication**: Set `password` in server config
67
- 2. **SSH Private Key from environment**: Set `SSH_PRIVATE_KEY` environment variable
68
- 3. **SSH Key file**: Set `key_path` in server config
118
+ 1. **Password authentication**: If `password` is set in that server's config
119
+ 2. **SSH Private Key from environment**: If `SSH_PRIVATE_KEY` environment variable is set (applies to all servers)
120
+ 3. **SSH Key file**: If `key_path` is set in that server's config
69
121
 
70
- ```bash
71
- # Using password (in config)
72
- shipfe deploy --profile dev
122
+ #### Usage Examples:
73
123
 
74
- # Using SSH private key from environment
75
- export SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)"
76
- shipfe deploy --profile dev
124
+ ```bash
125
+ # Each server can use different authentication
126
+ shipfe deploy --profile prod
77
127
 
78
- # Using SSH key file (in config)
79
- # Set "key_path": "/path/to/private/key" in server config
80
- shipfe deploy --profile dev
128
+ # Or override with environment variable for all servers
129
+ export SSH_PRIVATE_KEY="$(cat ~/.ssh/prod_key)"
130
+ shipfe deploy --profile prod
81
131
  ```
82
132
 
133
+ #### SSH Key Setup for Individual Servers:
134
+
135
+ 1. **Generate SSH key pairs** for each server:
136
+ ```bash
137
+ # For server 1
138
+ ssh-keygen -t rsa -b 4096 -f ~/.ssh/server1_key -C "server1"
139
+
140
+ # For server 2
141
+ ssh-keygen -t rsa -b 4096 -f ~/.ssh/server2_key -C "server2"
142
+ ```
143
+
144
+ 2. **Copy public keys to respective servers**:
145
+ ```bash
146
+ ssh-copy-id -i ~/.ssh/server1_key.pub user@server1.com
147
+ ssh-copy-id -i ~/.ssh/server2_key.pub user@server2.com
148
+ ```
149
+
150
+ 3. **Configure shipfe** with server-specific keys:
151
+ ```json
152
+ {
153
+ "servers": [
154
+ {
155
+ "host": "server1.com",
156
+ "key_path": "~/.ssh/server1_key"
157
+ },
158
+ {
159
+ "host": "server2.com",
160
+ "key_path": "~/.ssh/server2_key"
161
+ }
162
+ ]
163
+ }
164
+ ```
165
+
83
166
  ## Features
84
167
 
85
168
  - Multiple environment support
package/bin/shipfe CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipfe",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A deployment tool for web applications",
5
5
  "main": "index.js",
6
6
  "bin": {