You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Copy the entire output including BEGIN and END lines
71
78
```
72
79
73
-
### STAGING_HOST
80
+
### HOST
74
81
75
-
- Name: `STAGING_HOST`
82
+
- Name: `HOST`
76
83
- Value: Staging server hostname or IP address
77
84
- Example: `staging.example.com` or `192.168.1.100`
78
85
79
-
### STAGING_USER
86
+
### USER
80
87
81
-
- Name: `STAGING_USER`
88
+
- Name: `USER`
82
89
- Value: SSH username on staging server
83
90
- Example: `frankbria`
84
91
85
-
### STAGING_PROJECT_PATH
92
+
### PROJECT_PATH
86
93
87
-
- Name: `STAGING_PROJECT_PATH`
94
+
- Name: `PROJECT_PATH`
88
95
- Value: Absolute path to the CodeFRAME project on staging server
89
96
- Example: `/home/frankbria/projects/codeframe`
90
97
91
-
## Step 5: Verify Secrets
98
+
**Note**: These generic secret names can be reused across different environments (staging, production, etc.) by configuring them in each environment separately.
99
+
100
+
## Step 5: Verify Environment Configuration
92
101
93
-
After adding all secrets, verify they appear in the secrets list:
102
+
After adding all secrets, verify in **Settings** → **Environments** → **staging**:
94
103
95
-
- STAGING_SSH_KEY
96
-
- STAGING_HOST
97
-
- STAGING_USER
98
-
- STAGING_PROJECT_PATH
104
+
- ✅ Environment exists
105
+
- ✅ SSH_KEY configured
106
+
- ✅ HOST configured
107
+
- ✅ USER configured
108
+
- ✅ PROJECT_PATH configured
99
109
100
110
## Step 6: Test Deployment Workflow
101
111
@@ -115,39 +125,51 @@ After adding all secrets, verify they appear in the secrets list:
115
125
- Rotate SSH keys every 90 days
116
126
- To rotate:
117
127
1. Generate new key pair
118
-
2. Add new public key to staging server
119
-
3. Update `STAGING_SSH_KEY` secret in GitHub
120
-
4. Remove old public key from staging server
128
+
2. Add new public key to deployment server
129
+
3. Update `SSH_KEY` secret in the environment (Settings → Environments → staging)
130
+
4. Remove old public key from deployment server
121
131
5. Delete old private key locally
122
132
123
133
### Access Control
124
134
- Only grant repository admin access to trusted users
125
-
- Consider using a dedicated deployment user on staging server
135
+
- Consider using a dedicated deployment user on the server
126
136
- Audit secret access logs regularly
137
+
- Use environment protection rules to require approvals for sensitive deployments
127
138
128
139
## Troubleshooting
129
140
130
141
### "Permission denied (publickey)"
131
-
- Verify public key is in `~/.ssh/authorized_keys` on staging server
142
+
- Verify public key is in `~/.ssh/authorized_keys` on deployment server
132
143
- Check file permissions: `authorized_keys` should be 600, `.ssh` should be 700
133
-
- Verify `STAGING_SSH_KEY` secret contains the complete private key
144
+
- Verify `SSH_KEY` environment secret contains the complete private key
134
145
135
146
### "Host key verification failed"
136
147
- Workflow includes `ssh-keyscan` to add host key automatically
137
148
- If issue persists, manually add host key to workflow
138
149
139
150
### "Connection refused"
140
-
- Verify `STAGING_HOST` is correct
141
-
- Ensure staging server is accessible from internet
151
+
- Verify `HOST` environment secret is correct
152
+
- Ensure deployment server is accessible from internet
142
153
- Check firewall settings allow SSH (port 22)
143
154
144
155
### "No such file or directory" during deployment
145
-
- Verify `STAGING_PROJECT_PATH` is correct
146
-
- Ensure project directory exists on staging server
156
+
- Verify `PROJECT_PATH` environment secret is correct
157
+
- Ensure project directory exists on deployment server
147
158
- Check user has read/write permissions to project directory
148
159
160
+
## Using Multiple Environments
161
+
162
+
To configure production or other environments:
163
+
164
+
1. Create a new environment (e.g., `production`)
165
+
2. Add the same secret names (`SSH_KEY`, `HOST`, `USER`, `PROJECT_PATH`) with different values
166
+
3. Update workflow to reference the appropriate environment
167
+
168
+
This pattern allows using the same secret names across all environments while maintaining environment-specific values.
0 commit comments