@factiii/stack 0.1.181 → 0.1.182
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.
- package/LICENSE +21 -21
- package/README.md +441 -441
- package/bin/stack +300 -300
- package/dist/cli/dev-sync.js +16 -16
- package/dist/plugins/addons/auth/index.js +7 -7
- package/dist/plugins/addons/vercel/index.js +9 -9
- package/dist/plugins/addons/vercel/scanfix/config.js +10 -10
- package/dist/plugins/addons/vercel/scanfix/token.js +15 -15
- package/dist/plugins/approved.json +13 -13
- package/dist/plugins/pipelines/aws/index.js +12 -12
- package/dist/plugins/pipelines/aws/policies/bootstrap-policy.json +135 -135
- package/dist/plugins/pipelines/aws/prod.js +1 -1
- package/dist/plugins/pipelines/aws/scanfix/iam.d.ts.map +1 -1
- package/dist/plugins/pipelines/aws/scanfix/iam.js +40 -29
- package/dist/plugins/pipelines/aws/scanfix/iam.js.map +1 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.d.ts +3 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.d.ts.map +1 -1
- package/dist/plugins/pipelines/aws/utils/aws-helpers.js +31 -2
- package/dist/plugins/pipelines/aws/utils/aws-helpers.js.map +1 -1
- package/dist/plugins/pipelines/factiii/prod.js +21 -21
- package/dist/plugins/pipelines/factiii/staging.js +23 -23
- package/dist/plugins/pipelines/factiii/workflows/stack-ci.yml +75 -75
- package/dist/plugins/pipelines/factiii/workflows/stack-cicd-prod.yml +73 -73
- package/dist/plugins/servers/amazon-linux/index.js +16 -16
- package/dist/plugins/servers/mac/index.js +12 -12
- package/dist/plugins/servers/mac/staging.js +2 -2
- package/dist/plugins/servers/ubuntu/index.js +23 -23
- package/dist/plugins/servers/windows/index.js +15 -15
- package/dist/scripts/generate-all.js +73 -73
- package/dist/utils/deployment-report.js +2 -2
- package/dist/utils/secret-prompts.js +34 -34
- package/dist/utils/template-generator.js +74 -74
- package/package.json +93 -100
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
name: Stack CI Prod
|
|
2
|
-
|
|
3
|
-
# Generated by @factiii/stack v{VERSION}
|
|
4
|
-
# Runs builds and tests on push to prod branch.
|
|
5
|
-
# No deployment - deploy via SSH from dev machine.
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
push:
|
|
9
|
-
branches: [prod]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
ci:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
env:
|
|
15
|
-
CI: true
|
|
16
|
-
ENV: test
|
|
17
|
-
NODE_ENV: test
|
|
18
|
-
DATABASE_URL: "postgresql://postgres:password@localhost:5440/factiii-test?connect_timeout=300"
|
|
19
|
-
TEST_DATABASE_URL: "postgresql://postgres:password@localhost:5440/factiii-test?connect_timeout=300"
|
|
20
|
-
TEST_ADMIN_IP: "::ffff:127.0.0.1"
|
|
21
|
-
SITE_URL: http://localhost:3000
|
|
22
|
-
ALLOWED_ORIGINS: http://localhost:3000,http://localhost:5001
|
|
23
|
-
ACCESS_TOKEN_SECRET: test-secret-key
|
|
24
|
-
GOOGLE_CLIENT_ID: test-google-id
|
|
25
|
-
APPLE_CLIENT_ID: com.factiii.test
|
|
26
|
-
NEXT_PUBLIC_SITE_URL: http://localhost:3000
|
|
27
|
-
NEXT_PUBLIC_API_URL: http://localhost:5001
|
|
28
|
-
|
|
29
|
-
steps:
|
|
30
|
-
- name: Checkout
|
|
31
|
-
uses: actions/checkout@v4
|
|
32
|
-
|
|
33
|
-
- name: Setup pnpm
|
|
34
|
-
uses: pnpm/action-setup@v4
|
|
35
|
-
|
|
36
|
-
- name: Setup Node.js
|
|
37
|
-
uses: actions/setup-node@v4
|
|
38
|
-
with:
|
|
39
|
-
node-version: '24'
|
|
40
|
-
cache: 'pnpm'
|
|
41
|
-
|
|
42
|
-
- name: Install dependencies
|
|
43
|
-
run: pnpm install
|
|
44
|
-
|
|
45
|
-
- name: Build server
|
|
46
|
-
run: pnpm build
|
|
47
|
-
working-directory: apps/server
|
|
48
|
-
|
|
49
|
-
- name: Build client
|
|
50
|
-
run: pnpm build
|
|
51
|
-
working-directory: client
|
|
52
|
-
if: hashFiles('client/package.json') != ''
|
|
53
|
-
|
|
54
|
-
- name: Setup Java (for Android)
|
|
55
|
-
uses: actions/setup-java@v4
|
|
56
|
-
with:
|
|
57
|
-
distribution: 'temurin'
|
|
58
|
-
java-version: '17'
|
|
59
|
-
if: hashFiles('apps/mobile/android/build.gradle') != ''
|
|
60
|
-
|
|
61
|
-
- name: Build Android
|
|
62
|
-
run: |
|
|
63
|
-
cd apps/mobile/android
|
|
64
|
-
./gradlew assembleRelease
|
|
65
|
-
if: hashFiles('apps/mobile/android/build.gradle') != ''
|
|
66
|
-
|
|
67
|
-
- name: Start Docker containers
|
|
68
|
-
run: |
|
|
69
|
-
chmod +x ./start.sh
|
|
70
|
-
./start.sh
|
|
71
|
-
|
|
72
|
-
- name: Run tests
|
|
73
|
-
run: pnpm test:server
|
|
1
|
+
name: Stack CI Prod
|
|
2
|
+
|
|
3
|
+
# Generated by @factiii/stack v{VERSION}
|
|
4
|
+
# Runs builds and tests on push to prod branch.
|
|
5
|
+
# No deployment - deploy via SSH from dev machine.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [prod]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
ci:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
env:
|
|
15
|
+
CI: true
|
|
16
|
+
ENV: test
|
|
17
|
+
NODE_ENV: test
|
|
18
|
+
DATABASE_URL: "postgresql://postgres:password@localhost:5440/factiii-test?connect_timeout=300"
|
|
19
|
+
TEST_DATABASE_URL: "postgresql://postgres:password@localhost:5440/factiii-test?connect_timeout=300"
|
|
20
|
+
TEST_ADMIN_IP: "::ffff:127.0.0.1"
|
|
21
|
+
SITE_URL: http://localhost:3000
|
|
22
|
+
ALLOWED_ORIGINS: http://localhost:3000,http://localhost:5001
|
|
23
|
+
ACCESS_TOKEN_SECRET: test-secret-key
|
|
24
|
+
GOOGLE_CLIENT_ID: test-google-id
|
|
25
|
+
APPLE_CLIENT_ID: com.factiii.test
|
|
26
|
+
NEXT_PUBLIC_SITE_URL: http://localhost:3000
|
|
27
|
+
NEXT_PUBLIC_API_URL: http://localhost:5001
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout
|
|
31
|
+
uses: actions/checkout@v4
|
|
32
|
+
|
|
33
|
+
- name: Setup pnpm
|
|
34
|
+
uses: pnpm/action-setup@v4
|
|
35
|
+
|
|
36
|
+
- name: Setup Node.js
|
|
37
|
+
uses: actions/setup-node@v4
|
|
38
|
+
with:
|
|
39
|
+
node-version: '24'
|
|
40
|
+
cache: 'pnpm'
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
run: pnpm install
|
|
44
|
+
|
|
45
|
+
- name: Build server
|
|
46
|
+
run: pnpm build
|
|
47
|
+
working-directory: apps/server
|
|
48
|
+
|
|
49
|
+
- name: Build client
|
|
50
|
+
run: pnpm build
|
|
51
|
+
working-directory: client
|
|
52
|
+
if: hashFiles('client/package.json') != ''
|
|
53
|
+
|
|
54
|
+
- name: Setup Java (for Android)
|
|
55
|
+
uses: actions/setup-java@v4
|
|
56
|
+
with:
|
|
57
|
+
distribution: 'temurin'
|
|
58
|
+
java-version: '17'
|
|
59
|
+
if: hashFiles('apps/mobile/android/build.gradle') != ''
|
|
60
|
+
|
|
61
|
+
- name: Build Android
|
|
62
|
+
run: |
|
|
63
|
+
cd apps/mobile/android
|
|
64
|
+
./gradlew assembleRelease
|
|
65
|
+
if: hashFiles('apps/mobile/android/build.gradle') != ''
|
|
66
|
+
|
|
67
|
+
- name: Start Docker containers
|
|
68
|
+
run: |
|
|
69
|
+
chmod +x ./start.sh
|
|
70
|
+
./start.sh
|
|
71
|
+
|
|
72
|
+
- name: Run tests
|
|
73
|
+
run: pnpm test:server
|
|
@@ -99,13 +99,13 @@ class AmazonLinuxPlugin {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
static helpText = {
|
|
102
|
-
SSH: `
|
|
103
|
-
SSH private key for accessing the Amazon Linux server.
|
|
104
|
-
|
|
105
|
-
For AWS EC2:
|
|
106
|
-
- Use the key pair you created when launching the instance
|
|
107
|
-
- Download the .pem file from AWS Console
|
|
108
|
-
|
|
102
|
+
SSH: `
|
|
103
|
+
SSH private key for accessing the Amazon Linux server.
|
|
104
|
+
|
|
105
|
+
For AWS EC2:
|
|
106
|
+
- Use the key pair you created when launching the instance
|
|
107
|
+
- Download the .pem file from AWS Console
|
|
108
|
+
|
|
109
109
|
Default user for Amazon Linux: ec2-user`,
|
|
110
110
|
};
|
|
111
111
|
// ============================================================
|
|
@@ -152,21 +152,21 @@ class AmazonLinuxPlugin {
|
|
|
152
152
|
* Get the command to install Docker on Amazon Linux 2023
|
|
153
153
|
*/
|
|
154
154
|
static getDockerInstallCommand() {
|
|
155
|
-
return `
|
|
156
|
-
sudo dnf update -y && \
|
|
157
|
-
sudo dnf install -y docker && \
|
|
158
|
-
sudo systemctl start docker && \
|
|
159
|
-
sudo systemctl enable docker && \
|
|
160
|
-
sudo usermod -aG docker $USER
|
|
155
|
+
return `
|
|
156
|
+
sudo dnf update -y && \
|
|
157
|
+
sudo dnf install -y docker && \
|
|
158
|
+
sudo systemctl start docker && \
|
|
159
|
+
sudo systemctl enable docker && \
|
|
160
|
+
sudo usermod -aG docker $USER
|
|
161
161
|
`;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Get the command to install Node.js on Amazon Linux
|
|
165
165
|
*/
|
|
166
166
|
static getNodeInstallCommand() {
|
|
167
|
-
return `
|
|
168
|
-
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash - && \
|
|
169
|
-
sudo dnf install -y nodejs
|
|
167
|
+
return `
|
|
168
|
+
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash - && \
|
|
169
|
+
sudo dnf install -y nodejs
|
|
170
170
|
`;
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
@@ -138,16 +138,16 @@ class MacPlugin {
|
|
|
138
138
|
return Object.keys(config).length === 0;
|
|
139
139
|
}
|
|
140
140
|
static helpText = {
|
|
141
|
-
SSH: `
|
|
142
|
-
SSH private key for accessing the server.
|
|
143
|
-
|
|
144
|
-
Step 1: Generate a new SSH key pair (if needed):
|
|
145
|
-
ssh-keygen -t ed25519 -C "deploy-key" -f ~/.ssh/deploy_key
|
|
146
|
-
|
|
147
|
-
Step 2: Add PUBLIC key to server:
|
|
148
|
-
ssh-copy-id -i ~/.ssh/deploy_key.pub ubuntu@YOUR_HOST
|
|
149
|
-
|
|
150
|
-
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
141
|
+
SSH: `
|
|
142
|
+
SSH private key for accessing the server.
|
|
143
|
+
|
|
144
|
+
Step 1: Generate a new SSH key pair (if needed):
|
|
145
|
+
ssh-keygen -t ed25519 -C "deploy-key" -f ~/.ssh/deploy_key
|
|
146
|
+
|
|
147
|
+
Step 2: Add PUBLIC key to server:
|
|
148
|
+
ssh-copy-id -i ~/.ssh/deploy_key.pub ubuntu@YOUR_HOST
|
|
149
|
+
|
|
150
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
151
151
|
cat ~/.ssh/deploy_key`,
|
|
152
152
|
};
|
|
153
153
|
// ============================================================
|
|
@@ -238,8 +238,8 @@ class MacPlugin {
|
|
|
238
238
|
}
|
|
239
239
|
try {
|
|
240
240
|
const repoName = config.name ?? 'app';
|
|
241
|
-
await MacPlugin.sshExec(envConfig, `
|
|
242
|
-
cd ~/.factiii && docker compose stop ${repoName}-staging
|
|
241
|
+
await MacPlugin.sshExec(envConfig, `
|
|
242
|
+
cd ~/.factiii && docker compose stop ${repoName}-staging
|
|
243
243
|
`);
|
|
244
244
|
return { success: true, message: 'Staging containers stopped' };
|
|
245
245
|
}
|
|
@@ -291,7 +291,7 @@ async function writeEnvFile(envConfig, repoDir, environment, envVarsString) {
|
|
|
291
291
|
const escapedContent = envFileContent
|
|
292
292
|
.replace(/'/g, "'\\''")
|
|
293
293
|
.replace(/\n/g, '\\n');
|
|
294
|
-
await sshExecCommand(envConfig, `cat > ${repoDir}/${envFileName} << 'ENVEOF'
|
|
294
|
+
await sshExecCommand(envConfig, `cat > ${repoDir}/${envFileName} << 'ENVEOF'
|
|
295
295
|
${envFileContent}ENVEOF`);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
@@ -347,7 +347,7 @@ async function createEnvFromStaging(envConfig, repoDir) {
|
|
|
347
347
|
console.log(' 📝 Created .env from .env.staging (with host port replacement)');
|
|
348
348
|
}
|
|
349
349
|
else {
|
|
350
|
-
await sshExecCommand(envConfig, `cat > ${envPath} << 'ENVEOF'
|
|
350
|
+
await sshExecCommand(envConfig, `cat > ${envPath} << 'ENVEOF'
|
|
351
351
|
${updatedContent}ENVEOF`);
|
|
352
352
|
console.log(' 📝 Created .env from .env.staging on remote server (with host port replacement)');
|
|
353
353
|
}
|
|
@@ -99,16 +99,16 @@ class UbuntuPlugin {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
static helpText = {
|
|
102
|
-
SSH: `
|
|
103
|
-
SSH private key for accessing the Ubuntu server.
|
|
104
|
-
|
|
105
|
-
Step 1: Generate a new SSH key pair (if needed):
|
|
106
|
-
ssh-keygen -t ed25519 -C "deploy-key" -f ~/.ssh/deploy_key
|
|
107
|
-
|
|
108
|
-
Step 2: Add PUBLIC key to server:
|
|
109
|
-
ssh-copy-id -i ~/.ssh/deploy_key.pub ubuntu@YOUR_HOST
|
|
110
|
-
|
|
111
|
-
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
102
|
+
SSH: `
|
|
103
|
+
SSH private key for accessing the Ubuntu server.
|
|
104
|
+
|
|
105
|
+
Step 1: Generate a new SSH key pair (if needed):
|
|
106
|
+
ssh-keygen -t ed25519 -C "deploy-key" -f ~/.ssh/deploy_key
|
|
107
|
+
|
|
108
|
+
Step 2: Add PUBLIC key to server:
|
|
109
|
+
ssh-copy-id -i ~/.ssh/deploy_key.pub ubuntu@YOUR_HOST
|
|
110
|
+
|
|
111
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
112
112
|
cat ~/.ssh/deploy_key`,
|
|
113
113
|
};
|
|
114
114
|
// ============================================================
|
|
@@ -155,25 +155,25 @@ class UbuntuPlugin {
|
|
|
155
155
|
* Get the command to install Docker on Ubuntu
|
|
156
156
|
*/
|
|
157
157
|
static getDockerInstallCommand() {
|
|
158
|
-
return `
|
|
159
|
-
sudo apt-get update && \
|
|
160
|
-
sudo apt-get install -y ca-certificates curl gnupg && \
|
|
161
|
-
sudo install -m 0755 -d /etc/apt/keyrings && \
|
|
162
|
-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
|
|
163
|
-
sudo chmod a+r /etc/apt/keyrings/docker.gpg && \
|
|
164
|
-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
|
|
165
|
-
sudo apt-get update && \
|
|
166
|
-
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
|
|
167
|
-
sudo usermod -aG docker $USER
|
|
158
|
+
return `
|
|
159
|
+
sudo apt-get update && \
|
|
160
|
+
sudo apt-get install -y ca-certificates curl gnupg && \
|
|
161
|
+
sudo install -m 0755 -d /etc/apt/keyrings && \
|
|
162
|
+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
|
|
163
|
+
sudo chmod a+r /etc/apt/keyrings/docker.gpg && \
|
|
164
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
|
|
165
|
+
sudo apt-get update && \
|
|
166
|
+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
|
|
167
|
+
sudo usermod -aG docker $USER
|
|
168
168
|
`;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Get the command to install Node.js on Ubuntu
|
|
172
172
|
*/
|
|
173
173
|
static getNodeInstallCommand() {
|
|
174
|
-
return `
|
|
175
|
-
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && \
|
|
176
|
-
sudo apt-get install -y nodejs
|
|
174
|
+
return `
|
|
175
|
+
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && \
|
|
176
|
+
sudo apt-get install -y nodejs
|
|
177
177
|
`;
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
@@ -99,12 +99,12 @@ class WindowsPlugin {
|
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
static helpText = {
|
|
102
|
-
SSH: `
|
|
103
|
-
SSH/RDP credentials for accessing the Windows server.
|
|
104
|
-
|
|
105
|
-
For SSH access, ensure OpenSSH Server is installed on Windows:
|
|
106
|
-
- Settings > Apps > Optional Features > Add a feature > OpenSSH Server
|
|
107
|
-
|
|
102
|
+
SSH: `
|
|
103
|
+
SSH/RDP credentials for accessing the Windows server.
|
|
104
|
+
|
|
105
|
+
For SSH access, ensure OpenSSH Server is installed on Windows:
|
|
106
|
+
- Settings > Apps > Optional Features > Add a feature > OpenSSH Server
|
|
107
|
+
|
|
108
108
|
For RDP access, use Remote Desktop Connection.`,
|
|
109
109
|
};
|
|
110
110
|
// ============================================================
|
|
@@ -182,11 +182,11 @@ class WindowsPlugin {
|
|
|
182
182
|
* Requires Docker Desktop or WSL2 with Docker
|
|
183
183
|
*/
|
|
184
184
|
static getDockerInstallCommand() {
|
|
185
|
-
return `
|
|
186
|
-
# Install Docker Desktop via Chocolatey
|
|
187
|
-
choco install docker-desktop -y
|
|
188
|
-
# Or install via winget
|
|
189
|
-
# winget install Docker.DockerDesktop
|
|
185
|
+
return `
|
|
186
|
+
# Install Docker Desktop via Chocolatey
|
|
187
|
+
choco install docker-desktop -y
|
|
188
|
+
# Or install via winget
|
|
189
|
+
# winget install Docker.DockerDesktop
|
|
190
190
|
`;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
@@ -205,10 +205,10 @@ class WindowsPlugin {
|
|
|
205
205
|
* Get the command to install Chocolatey (package manager)
|
|
206
206
|
*/
|
|
207
207
|
static getChocoInstallCommand() {
|
|
208
|
-
return `
|
|
209
|
-
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
210
|
-
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
211
|
-
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
208
|
+
return `
|
|
209
|
+
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
210
|
+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
211
|
+
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
212
212
|
`;
|
|
213
213
|
}
|
|
214
214
|
// ============================================================
|
|
@@ -271,31 +271,31 @@ function generateNginx(allConfigs) {
|
|
|
271
271
|
return 0;
|
|
272
272
|
}
|
|
273
273
|
// Generate nginx config
|
|
274
|
-
let nginxConf = `# Auto-generated nginx configuration
|
|
275
|
-
# Generated by: npx stack (generate-all)
|
|
276
|
-
# Do not edit directly - modify stack.yml files and run: npx stack deploy
|
|
277
|
-
|
|
278
|
-
events {
|
|
279
|
-
worker_connections 1024;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
http {
|
|
283
|
-
include /etc/nginx/mime.types;
|
|
284
|
-
default_type application/octet-stream;
|
|
285
|
-
|
|
286
|
-
sendfile on;
|
|
287
|
-
keepalive_timeout 65;
|
|
288
|
-
client_max_body_size 100M;
|
|
289
|
-
|
|
290
|
-
# Logging
|
|
291
|
-
access_log /var/log/nginx/access.log;
|
|
292
|
-
error_log /var/log/nginx/error.log;
|
|
293
|
-
|
|
294
|
-
# Gzip
|
|
295
|
-
gzip on;
|
|
296
|
-
gzip_vary on;
|
|
297
|
-
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
298
|
-
|
|
274
|
+
let nginxConf = `# Auto-generated nginx configuration
|
|
275
|
+
# Generated by: npx stack (generate-all)
|
|
276
|
+
# Do not edit directly - modify stack.yml files and run: npx stack deploy
|
|
277
|
+
|
|
278
|
+
events {
|
|
279
|
+
worker_connections 1024;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
http {
|
|
283
|
+
include /etc/nginx/mime.types;
|
|
284
|
+
default_type application/octet-stream;
|
|
285
|
+
|
|
286
|
+
sendfile on;
|
|
287
|
+
keepalive_timeout 65;
|
|
288
|
+
client_max_body_size 100M;
|
|
289
|
+
|
|
290
|
+
# Logging
|
|
291
|
+
access_log /var/log/nginx/access.log;
|
|
292
|
+
error_log /var/log/nginx/error.log;
|
|
293
|
+
|
|
294
|
+
# Gzip
|
|
295
|
+
gzip on;
|
|
296
|
+
gzip_vary on;
|
|
297
|
+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
298
|
+
|
|
299
299
|
`;
|
|
300
300
|
// ============================================================
|
|
301
301
|
// CRITICAL: HTTPS Certificate Paths
|
|
@@ -308,54 +308,54 @@ http {
|
|
|
308
308
|
for (const { domain, service, port } of routes) {
|
|
309
309
|
// Always generate HTTPS-capable config
|
|
310
310
|
// Certificates must exist before nginx can start (obtained via: npx stack fix --staging/--prod)
|
|
311
|
-
nginxConf += `
|
|
312
|
-
# ${service} - ${domain}
|
|
313
|
-
|
|
314
|
-
# HTTP - ACME challenge + redirect to HTTPS
|
|
315
|
-
server {
|
|
316
|
-
listen 80;
|
|
317
|
-
server_name ${domain};
|
|
318
|
-
|
|
319
|
-
# Allow certbot ACME challenge (for renewals)
|
|
320
|
-
location /.well-known/acme-challenge/ {
|
|
321
|
-
root /var/www/certbot;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
# Redirect all other traffic to HTTPS
|
|
325
|
-
location / {
|
|
326
|
-
return 301 https://$server_name$request_uri;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
# HTTPS - main server block
|
|
331
|
-
server {
|
|
332
|
-
listen 443 ssl;
|
|
333
|
-
http2 on;
|
|
334
|
-
server_name ${domain};
|
|
335
|
-
|
|
336
|
-
# SSL certificate paths (Let's Encrypt)
|
|
337
|
-
ssl_certificate /etc/letsencrypt/live/${domain}/fullchain.pem;
|
|
338
|
-
ssl_certificate_key /etc/letsencrypt/live/${domain}/privkey.pem;
|
|
339
|
-
|
|
340
|
-
# SSL security settings
|
|
341
|
-
ssl_protocols TLSv1.2 TLSv1.3;
|
|
342
|
-
ssl_prefer_server_ciphers on;
|
|
343
|
-
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
|
|
344
|
-
ssl_session_cache shared:SSL:10m;
|
|
345
|
-
ssl_session_timeout 10m;
|
|
346
|
-
|
|
347
|
-
location / {
|
|
348
|
-
proxy_pass http://${service}:${port};
|
|
349
|
-
proxy_http_version 1.1;
|
|
350
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
351
|
-
proxy_set_header Connection 'upgrade';
|
|
352
|
-
proxy_set_header Host $host;
|
|
353
|
-
proxy_cache_bypass $http_upgrade;
|
|
354
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
355
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
356
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
311
|
+
nginxConf += `
|
|
312
|
+
# ${service} - ${domain}
|
|
313
|
+
|
|
314
|
+
# HTTP - ACME challenge + redirect to HTTPS
|
|
315
|
+
server {
|
|
316
|
+
listen 80;
|
|
317
|
+
server_name ${domain};
|
|
318
|
+
|
|
319
|
+
# Allow certbot ACME challenge (for renewals)
|
|
320
|
+
location /.well-known/acme-challenge/ {
|
|
321
|
+
root /var/www/certbot;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
# Redirect all other traffic to HTTPS
|
|
325
|
+
location / {
|
|
326
|
+
return 301 https://$server_name$request_uri;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
# HTTPS - main server block
|
|
331
|
+
server {
|
|
332
|
+
listen 443 ssl;
|
|
333
|
+
http2 on;
|
|
334
|
+
server_name ${domain};
|
|
335
|
+
|
|
336
|
+
# SSL certificate paths (Let's Encrypt)
|
|
337
|
+
ssl_certificate /etc/letsencrypt/live/${domain}/fullchain.pem;
|
|
338
|
+
ssl_certificate_key /etc/letsencrypt/live/${domain}/privkey.pem;
|
|
339
|
+
|
|
340
|
+
# SSL security settings
|
|
341
|
+
ssl_protocols TLSv1.2 TLSv1.3;
|
|
342
|
+
ssl_prefer_server_ciphers on;
|
|
343
|
+
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
|
|
344
|
+
ssl_session_cache shared:SSL:10m;
|
|
345
|
+
ssl_session_timeout 10m;
|
|
346
|
+
|
|
347
|
+
location / {
|
|
348
|
+
proxy_pass http://${service}:${port};
|
|
349
|
+
proxy_http_version 1.1;
|
|
350
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
351
|
+
proxy_set_header Connection 'upgrade';
|
|
352
|
+
proxy_set_header Host $host;
|
|
353
|
+
proxy_cache_bypass $http_upgrade;
|
|
354
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
355
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
356
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
359
|
`;
|
|
360
360
|
}
|
|
361
361
|
nginxConf += `}\n`;
|
|
@@ -154,8 +154,8 @@ function formatDeploymentReport(data) {
|
|
|
154
154
|
function formatWorkflowSummary(data) {
|
|
155
155
|
const report = formatDeploymentReport(data);
|
|
156
156
|
// Workflow summaries support markdown, so we can enhance it
|
|
157
|
-
return `\`\`\`
|
|
158
|
-
${report}
|
|
157
|
+
return `\`\`\`
|
|
158
|
+
${report}
|
|
159
159
|
\`\`\``;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
@@ -64,16 +64,16 @@ const SECRET_METADATA = {
|
|
|
64
64
|
STAGING_SSH: {
|
|
65
65
|
type: 'ssh_key',
|
|
66
66
|
description: 'SSH private key for accessing staging server',
|
|
67
|
-
helpText: `
|
|
68
|
-
Step 1: Generate a new SSH key pair:
|
|
69
|
-
ssh-keygen -t ed25519 -C "staging-deploy" -f ~/.ssh/staging_deploy
|
|
70
|
-
|
|
71
|
-
Step 2: Add PUBLIC key to your staging server:
|
|
72
|
-
ssh-copy-id -i ~/.ssh/staging_deploy.pub ubuntu@YOUR_HOST
|
|
73
|
-
|
|
74
|
-
(HOST is configured in stack.yml → environments.staging.host)
|
|
75
|
-
|
|
76
|
-
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
67
|
+
helpText: `
|
|
68
|
+
Step 1: Generate a new SSH key pair:
|
|
69
|
+
ssh-keygen -t ed25519 -C "staging-deploy" -f ~/.ssh/staging_deploy
|
|
70
|
+
|
|
71
|
+
Step 2: Add PUBLIC key to your staging server:
|
|
72
|
+
ssh-copy-id -i ~/.ssh/staging_deploy.pub ubuntu@YOUR_HOST
|
|
73
|
+
|
|
74
|
+
(HOST is configured in stack.yml → environments.staging.host)
|
|
75
|
+
|
|
76
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
77
77
|
cat ~/.ssh/staging_deploy`,
|
|
78
78
|
validation: (value) => {
|
|
79
79
|
if (!value || value.trim().length === 0) {
|
|
@@ -91,16 +91,16 @@ const SECRET_METADATA = {
|
|
|
91
91
|
PROD_SSH: {
|
|
92
92
|
type: 'ssh_key',
|
|
93
93
|
description: 'SSH private key for accessing production server',
|
|
94
|
-
helpText: `
|
|
95
|
-
Step 1: Generate a new SSH key pair:
|
|
96
|
-
ssh-keygen -t ed25519 -C "production-deploy" -f ~/.ssh/prod_deploy
|
|
97
|
-
|
|
98
|
-
Step 2: Add PUBLIC key to your production server:
|
|
99
|
-
ssh-copy-id -i ~/.ssh/prod_deploy.pub ubuntu@YOUR_HOST
|
|
100
|
-
|
|
101
|
-
(HOST is configured in stack.yml → environments.production.host)
|
|
102
|
-
|
|
103
|
-
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
94
|
+
helpText: `
|
|
95
|
+
Step 1: Generate a new SSH key pair:
|
|
96
|
+
ssh-keygen -t ed25519 -C "production-deploy" -f ~/.ssh/prod_deploy
|
|
97
|
+
|
|
98
|
+
Step 2: Add PUBLIC key to your production server:
|
|
99
|
+
ssh-copy-id -i ~/.ssh/prod_deploy.pub ubuntu@YOUR_HOST
|
|
100
|
+
|
|
101
|
+
(HOST is configured in stack.yml → environments.production.host)
|
|
102
|
+
|
|
103
|
+
Step 3: Paste the PRIVATE key below (multi-line, end with blank line):
|
|
104
104
|
cat ~/.ssh/prod_deploy`,
|
|
105
105
|
validation: (value) => {
|
|
106
106
|
if (!value || value.trim().length === 0) {
|
|
@@ -118,14 +118,14 @@ const SECRET_METADATA = {
|
|
|
118
118
|
AWS_SECRET_ACCESS_KEY: {
|
|
119
119
|
type: 'aws_secret',
|
|
120
120
|
description: 'AWS Secret Access Key (the only secret AWS value)',
|
|
121
|
-
helpText: `
|
|
122
|
-
Get from AWS Console: IAM → Users → Security credentials
|
|
123
|
-
|
|
124
|
-
This is shown only once when you create the key.
|
|
125
|
-
If lost, you must create a new key pair.
|
|
126
|
-
|
|
127
|
-
Note: AWS_ACCESS_KEY_ID and AWS_REGION go in stack.yml (not secrets)
|
|
128
|
-
|
|
121
|
+
helpText: `
|
|
122
|
+
Get from AWS Console: IAM → Users → Security credentials
|
|
123
|
+
|
|
124
|
+
This is shown only once when you create the key.
|
|
125
|
+
If lost, you must create a new key pair.
|
|
126
|
+
|
|
127
|
+
Note: AWS_ACCESS_KEY_ID and AWS_REGION go in stack.yml (not secrets)
|
|
128
|
+
|
|
129
129
|
Enter AWS Secret Access Key:`,
|
|
130
130
|
validation: (value) => {
|
|
131
131
|
if (!value || value.trim().length === 0) {
|
|
@@ -143,12 +143,12 @@ const SECRET_METADATA = {
|
|
|
143
143
|
VERCEL_TOKEN: {
|
|
144
144
|
type: 'api_token',
|
|
145
145
|
description: 'Vercel API Token for deployments',
|
|
146
|
-
helpText: `
|
|
147
|
-
Get your token from: https://vercel.com/account/tokens
|
|
148
|
-
Create a new token with:
|
|
149
|
-
- Scope: Full Account (or specific team)
|
|
150
|
-
- Expiration: No Expiration (or custom)
|
|
151
|
-
|
|
146
|
+
helpText: `
|
|
147
|
+
Get your token from: https://vercel.com/account/tokens
|
|
148
|
+
Create a new token with:
|
|
149
|
+
- Scope: Full Account (or specific team)
|
|
150
|
+
- Expiration: No Expiration (or custom)
|
|
151
|
+
|
|
152
152
|
Enter Vercel API Token:`,
|
|
153
153
|
validation: (value) => {
|
|
154
154
|
if (!value || value.trim().length === 0) {
|