@expressots/cli 3.0.0 → 4.0.0-preview.2
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/README.md +41 -95
- package/bin/cicd/cli.d.ts +6 -0
- package/bin/cicd/cli.js +126 -0
- package/bin/cicd/form.d.ts +29 -0
- package/bin/cicd/form.js +345 -0
- package/bin/cicd/generators/azure-devops.d.ts +2 -0
- package/bin/cicd/generators/azure-devops.js +370 -0
- package/bin/cicd/generators/bitbucket.d.ts +2 -0
- package/bin/cicd/generators/bitbucket.js +217 -0
- package/bin/cicd/generators/circleci.d.ts +2 -0
- package/bin/cicd/generators/circleci.js +274 -0
- package/bin/cicd/generators/github-actions.d.ts +14 -0
- package/bin/cicd/generators/github-actions.js +426 -0
- package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
- package/bin/cicd/generators/gitlab-ci.js +237 -0
- package/bin/cicd/generators/index.d.ts +6 -0
- package/bin/cicd/generators/index.js +15 -0
- package/bin/cicd/generators/jenkins.d.ts +2 -0
- package/bin/cicd/generators/jenkins.js +248 -0
- package/bin/cicd/generators/template-loader.d.ts +17 -0
- package/bin/cicd/generators/template-loader.js +128 -0
- package/bin/cicd/index.d.ts +1 -0
- package/bin/cicd/index.js +5 -0
- package/bin/cli.d.ts +1 -1
- package/bin/cli.js +18 -3
- package/bin/commands/project.commands.d.ts +19 -6
- package/bin/commands/project.commands.js +390 -61
- package/bin/config/index.d.ts +5 -0
- package/bin/config/index.js +10 -0
- package/bin/config/manager.d.ts +98 -0
- package/bin/config/manager.js +222 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
- package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
- package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
- package/bin/containerize/analyzers/project-analyzer.js +150 -0
- package/bin/containerize/cli.d.ts +4 -0
- package/bin/containerize/cli.js +113 -0
- package/bin/containerize/form.d.ts +15 -0
- package/bin/containerize/form.js +154 -0
- package/bin/containerize/generators/ci-generator.d.ts +31 -0
- package/bin/containerize/generators/ci-generator.js +936 -0
- package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
- package/bin/containerize/generators/docker-compose-generator.js +186 -0
- package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
- package/bin/containerize/generators/dockerfile-generator.js +635 -0
- package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
- package/bin/containerize/generators/kubernetes-generator.js +133 -0
- package/bin/containerize/generators/template-loader.d.ts +36 -0
- package/bin/containerize/generators/template-loader.js +129 -0
- package/bin/containerize/index.d.ts +4 -0
- package/bin/containerize/index.js +13 -0
- package/bin/containerize/presets/preset-registry.d.ts +20 -0
- package/bin/containerize/presets/preset-registry.js +102 -0
- package/bin/costs/cli.d.ts +5 -0
- package/bin/costs/cli.js +183 -0
- package/bin/costs/form.d.ts +44 -0
- package/bin/costs/form.js +412 -0
- package/bin/costs/index.d.ts +4 -0
- package/bin/costs/index.js +25 -0
- package/bin/costs/pricing-manager.d.ts +84 -0
- package/bin/costs/pricing-manager.js +342 -0
- package/bin/costs/providers/index.d.ts +32 -0
- package/bin/costs/providers/index.js +153 -0
- package/bin/costs/sources/api-source.d.ts +10 -0
- package/bin/costs/sources/api-source.js +32 -0
- package/bin/costs/sources/index.d.ts +6 -0
- package/bin/costs/sources/index.js +15 -0
- package/bin/costs/sources/local-json-source.d.ts +23 -0
- package/bin/costs/sources/local-json-source.js +59 -0
- package/bin/costs/sources/remote-json-source.d.ts +11 -0
- package/bin/costs/sources/remote-json-source.js +53 -0
- package/bin/costs/types.d.ts +53 -0
- package/bin/costs/types.js +5 -0
- package/bin/dev/cli.d.ts +4 -0
- package/bin/dev/cli.js +134 -0
- package/bin/dev/form.d.ts +36 -0
- package/bin/dev/form.js +254 -0
- package/bin/dev/index.d.ts +1 -0
- package/bin/dev/index.js +5 -0
- package/bin/generate/cli.js +29 -2
- package/bin/generate/form.d.ts +5 -1
- package/bin/generate/form.js +3 -3
- package/bin/generate/templates/nonopinionated/config.tpl +12 -0
- package/bin/generate/templates/nonopinionated/event.tpl +10 -0
- package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
- package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
- package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
- package/bin/generate/templates/opinionated/config.tpl +47 -0
- package/bin/generate/templates/opinionated/entity.tpl +1 -8
- package/bin/generate/templates/opinionated/event.tpl +15 -0
- package/bin/generate/templates/opinionated/guard.tpl +41 -0
- package/bin/generate/templates/opinionated/handler.tpl +23 -0
- package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
- package/bin/generate/utils/command-utils.d.ts +7 -3
- package/bin/generate/utils/command-utils.js +95 -31
- package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
- package/bin/generate/utils/nonopininated-cmd.js +100 -1
- package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
- package/bin/generate/utils/opinionated-cmd.js +112 -7
- package/bin/generate/utils/string-utils.d.ts +6 -0
- package/bin/generate/utils/string-utils.js +13 -1
- package/bin/help/form.js +11 -3
- package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
- package/bin/migrate/analyzers/platform-detector.js +116 -0
- package/bin/migrate/cli.d.ts +6 -0
- package/bin/migrate/cli.js +96 -0
- package/bin/migrate/form.d.ts +25 -0
- package/bin/migrate/form.js +347 -0
- package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
- package/bin/migrate/generators/compose-to-k8s.js +324 -0
- package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
- package/bin/migrate/generators/compose-to-railway.js +138 -0
- package/bin/migrate/generators/compose-to-render.d.ts +2 -0
- package/bin/migrate/generators/compose-to-render.js +148 -0
- package/bin/migrate/generators/generic-migration.d.ts +9 -0
- package/bin/migrate/generators/generic-migration.js +221 -0
- package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-fly.js +291 -0
- package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-railway.js +283 -0
- package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
- package/bin/migrate/generators/heroku-to-render.js +148 -0
- package/bin/migrate/generators/index.d.ts +7 -0
- package/bin/migrate/generators/index.js +17 -0
- package/bin/migrate/generators/template-loader.d.ts +21 -0
- package/bin/migrate/generators/template-loader.js +59 -0
- package/bin/migrate/index.d.ts +1 -0
- package/bin/migrate/index.js +5 -0
- package/bin/new/cli.js +21 -6
- package/bin/new/form.d.ts +25 -4
- package/bin/new/form.js +285 -70
- package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
- package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
- package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
- package/bin/profile/analyzers/image-analyzer.js +85 -0
- package/bin/profile/cli.d.ts +4 -0
- package/bin/profile/cli.js +92 -0
- package/bin/profile/form.d.ts +56 -0
- package/bin/profile/form.js +400 -0
- package/bin/profile/index.d.ts +1 -0
- package/bin/profile/index.js +5 -0
- package/bin/profile/optimizers/index.d.ts +19 -0
- package/bin/profile/optimizers/index.js +137 -0
- package/bin/providers/add/form.d.ts +1 -1
- package/bin/providers/add/form.js +27 -6
- package/bin/providers/create/form.js +2 -1
- package/bin/scripts/form.js +27 -5
- package/bin/studio/cli.d.ts +15 -0
- package/bin/studio/cli.js +166 -0
- package/bin/studio/index.d.ts +5 -0
- package/bin/studio/index.js +9 -0
- package/bin/templates/cache.d.ts +54 -0
- package/bin/templates/cache.js +180 -0
- package/bin/templates/cli.d.ts +8 -0
- package/bin/templates/cli.js +292 -0
- package/bin/templates/fetcher.d.ts +49 -0
- package/bin/templates/fetcher.js +208 -0
- package/bin/templates/index.d.ts +11 -0
- package/bin/templates/index.js +37 -0
- package/bin/templates/manager.d.ts +116 -0
- package/bin/templates/manager.js +323 -0
- package/bin/templates/renderer.d.ts +49 -0
- package/bin/templates/renderer.js +204 -0
- package/bin/templates/types.d.ts +51 -0
- package/bin/templates/types.js +5 -0
- package/bin/utils/add-module-to-container.d.ts +2 -2
- package/bin/utils/add-module-to-container.js +15 -5
- package/bin/utils/cli-ui.d.ts +30 -3
- package/bin/utils/cli-ui.js +95 -13
- package/bin/utils/index.d.ts +4 -0
- package/bin/utils/index.js +4 -0
- package/bin/utils/input-validation.d.ts +50 -0
- package/bin/utils/input-validation.js +143 -0
- package/bin/utils/package-manager-commands.d.ts +24 -0
- package/bin/utils/package-manager-commands.js +50 -0
- package/bin/utils/safe-spawn.d.ts +35 -0
- package/bin/utils/safe-spawn.js +51 -0
- package/bin/utils/update-tsconfig-paths.d.ts +35 -0
- package/bin/utils/update-tsconfig-paths.js +286 -0
- package/package.json +154 -154
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateComposeToRailway = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
async function generateComposeToRailway(outputDir, options) {
|
|
11
|
+
console.log(chalk_1.default.yellow(" Generating Docker Compose → Railway migration..."));
|
|
12
|
+
// Generate railway.json
|
|
13
|
+
const railwayConfig = {
|
|
14
|
+
$schema: "https://railway.app/railway.schema.json",
|
|
15
|
+
build: {
|
|
16
|
+
builder: "DOCKERFILE",
|
|
17
|
+
dockerfilePath: "Dockerfile",
|
|
18
|
+
},
|
|
19
|
+
deploy: {
|
|
20
|
+
startCommand: "npm start",
|
|
21
|
+
healthcheckPath: "/health",
|
|
22
|
+
healthcheckTimeout: 300,
|
|
23
|
+
restartPolicyType: "ON_FAILURE",
|
|
24
|
+
restartPolicyMaxRetries: 10,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "railway.json"), JSON.stringify(railwayConfig, null, 2), "utf-8");
|
|
28
|
+
console.log(chalk_1.default.green(" ✓ Created railway.json"));
|
|
29
|
+
// Generate service mapping
|
|
30
|
+
const serviceMapping = generateServiceMapping();
|
|
31
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "service-mapping.md"), serviceMapping, "utf-8");
|
|
32
|
+
console.log(chalk_1.default.green(" ✓ Created service-mapping.md"));
|
|
33
|
+
// Generate checklist
|
|
34
|
+
const checklist = generateRailwayFromComposeChecklist();
|
|
35
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "MIGRATION_CHECKLIST.md"), checklist, "utf-8");
|
|
36
|
+
console.log(chalk_1.default.green(" ✓ Created MIGRATION_CHECKLIST.md"));
|
|
37
|
+
}
|
|
38
|
+
exports.generateComposeToRailway = generateComposeToRailway;
|
|
39
|
+
function generateServiceMapping() {
|
|
40
|
+
return `# Service Mapping: Docker Compose → Railway
|
|
41
|
+
|
|
42
|
+
## How Docker Compose Services Map to Railway
|
|
43
|
+
|
|
44
|
+
| Compose Service | Railway Service | Notes |
|
|
45
|
+
|-----------------|-----------------|-------|
|
|
46
|
+
| Your app service | Railway Web Service | Main application |
|
|
47
|
+
| postgres/mysql | Railway Database | Use Railway templates |
|
|
48
|
+
| redis | Railway Redis | Use Railway Redis template |
|
|
49
|
+
| nginx | Not needed | Railway handles routing |
|
|
50
|
+
|
|
51
|
+
## Database Services
|
|
52
|
+
|
|
53
|
+
Railway provides managed databases. Instead of running in a container:
|
|
54
|
+
|
|
55
|
+
1. **PostgreSQL**: Add PostgreSQL service from Railway dashboard
|
|
56
|
+
2. **MySQL**: Add MySQL service from Railway dashboard
|
|
57
|
+
3. **Redis**: Add Redis service from Railway dashboard
|
|
58
|
+
4. **MongoDB**: Add MongoDB service from Railway dashboard
|
|
59
|
+
|
|
60
|
+
The connection strings are automatically injected as environment variables.
|
|
61
|
+
|
|
62
|
+
## Volumes
|
|
63
|
+
|
|
64
|
+
Railway handles persistent storage differently:
|
|
65
|
+
|
|
66
|
+
- **Database data**: Managed by Railway database services
|
|
67
|
+
- **File uploads**: Consider using S3/R2/GCS instead
|
|
68
|
+
- **Logs**: Available in Railway dashboard
|
|
69
|
+
|
|
70
|
+
## Environment Variables
|
|
71
|
+
|
|
72
|
+
Docker Compose environment variables should be set in Railway:
|
|
73
|
+
|
|
74
|
+
\`\`\`bash
|
|
75
|
+
# Using Railway CLI
|
|
76
|
+
railway variables set DATABASE_URL=\${{Postgres.DATABASE_URL}}
|
|
77
|
+
railway variables set REDIS_URL=\${{Redis.REDIS_URL}}
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
Or use the Railway dashboard for variable management.
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
function generateRailwayFromComposeChecklist() {
|
|
84
|
+
return `# Migration Checklist: Docker Compose → Railway
|
|
85
|
+
|
|
86
|
+
## Pre-Migration
|
|
87
|
+
|
|
88
|
+
- [ ] Review docker-compose.yml services
|
|
89
|
+
- [ ] List all environment variables
|
|
90
|
+
- [ ] Identify database and cache services
|
|
91
|
+
- [ ] Ensure Dockerfile is working
|
|
92
|
+
|
|
93
|
+
## Railway Setup
|
|
94
|
+
|
|
95
|
+
- [ ] Create Railway account
|
|
96
|
+
- [ ] Install CLI: \`npm install -g @railway/cli\`
|
|
97
|
+
- [ ] Login: \`railway login\`
|
|
98
|
+
- [ ] Create project: \`railway init\`
|
|
99
|
+
|
|
100
|
+
## Service Migration
|
|
101
|
+
|
|
102
|
+
### Main Application
|
|
103
|
+
- [ ] Copy railway.json to project
|
|
104
|
+
- [ ] Deploy: \`railway up\`
|
|
105
|
+
- [ ] Verify deployment
|
|
106
|
+
|
|
107
|
+
### Database (if applicable)
|
|
108
|
+
- [ ] Add PostgreSQL/MySQL from Railway dashboard
|
|
109
|
+
- [ ] Note the connection string variable
|
|
110
|
+
- [ ] Update app to use Railway database URL
|
|
111
|
+
|
|
112
|
+
### Redis (if applicable)
|
|
113
|
+
- [ ] Add Redis from Railway dashboard
|
|
114
|
+
- [ ] Update REDIS_URL to use Railway variable
|
|
115
|
+
|
|
116
|
+
## Environment Variables
|
|
117
|
+
|
|
118
|
+
- [ ] Set all required environment variables
|
|
119
|
+
- [ ] Use \`\${{ServiceName.VARIABLE}}\` for service references
|
|
120
|
+
- [ ] Verify with \`railway variables\`
|
|
121
|
+
|
|
122
|
+
## Volumes & Persistent Data
|
|
123
|
+
|
|
124
|
+
- [ ] Migrate file uploads to S3/R2 if applicable
|
|
125
|
+
- [ ] Export database data and import to Railway
|
|
126
|
+
|
|
127
|
+
## Networking
|
|
128
|
+
|
|
129
|
+
- [ ] Configure custom domain (optional)
|
|
130
|
+
- [ ] Railway handles SSL automatically
|
|
131
|
+
|
|
132
|
+
## Post-Migration
|
|
133
|
+
|
|
134
|
+
- [ ] Verify all endpoints
|
|
135
|
+
- [ ] Monitor logs: \`railway logs\`
|
|
136
|
+
- [ ] Stop docker-compose locally
|
|
137
|
+
`;
|
|
138
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateComposeToRender = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
async function generateComposeToRender(outputDir, options) {
|
|
11
|
+
console.log(chalk_1.default.yellow(" Generating Docker Compose → Render migration..."));
|
|
12
|
+
// Generate render.yaml blueprint
|
|
13
|
+
const renderConfig = generateRenderBlueprint();
|
|
14
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "render.yaml"), renderConfig, "utf-8");
|
|
15
|
+
console.log(chalk_1.default.green(" ✓ Created render.yaml"));
|
|
16
|
+
// Generate checklist
|
|
17
|
+
const checklist = generateRenderFromComposeChecklist();
|
|
18
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "MIGRATION_CHECKLIST.md"), checklist, "utf-8");
|
|
19
|
+
console.log(chalk_1.default.green(" ✓ Created MIGRATION_CHECKLIST.md"));
|
|
20
|
+
}
|
|
21
|
+
exports.generateComposeToRender = generateComposeToRender;
|
|
22
|
+
function generateRenderBlueprint() {
|
|
23
|
+
return `# Render Blueprint
|
|
24
|
+
# Generated by ExpressoTS CLI
|
|
25
|
+
# Migrated from Docker Compose
|
|
26
|
+
|
|
27
|
+
services:
|
|
28
|
+
# Main application service
|
|
29
|
+
- type: web
|
|
30
|
+
name: expressots-app
|
|
31
|
+
env: docker
|
|
32
|
+
region: oregon
|
|
33
|
+
plan: starter
|
|
34
|
+
dockerfilePath: ./Dockerfile
|
|
35
|
+
dockerContext: .
|
|
36
|
+
healthCheckPath: /health
|
|
37
|
+
envVars:
|
|
38
|
+
- key: NODE_ENV
|
|
39
|
+
value: production
|
|
40
|
+
- key: PORT
|
|
41
|
+
value: 3000
|
|
42
|
+
# Reference database if created below
|
|
43
|
+
# - key: DATABASE_URL
|
|
44
|
+
# fromDatabase:
|
|
45
|
+
# name: expressots-db
|
|
46
|
+
# property: connectionString
|
|
47
|
+
# - key: REDIS_URL
|
|
48
|
+
# fromService:
|
|
49
|
+
# name: expressots-redis
|
|
50
|
+
# type: redis
|
|
51
|
+
# property: connectionString
|
|
52
|
+
|
|
53
|
+
# Uncomment to add PostgreSQL
|
|
54
|
+
# databases:
|
|
55
|
+
# - name: expressots-db
|
|
56
|
+
# databaseName: expressots
|
|
57
|
+
# user: expressots
|
|
58
|
+
# plan: starter
|
|
59
|
+
|
|
60
|
+
# Uncomment to add Redis
|
|
61
|
+
# services:
|
|
62
|
+
# - type: redis
|
|
63
|
+
# name: expressots-redis
|
|
64
|
+
# plan: starter
|
|
65
|
+
# maxmemoryPolicy: noeviction
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
function generateRenderFromComposeChecklist() {
|
|
69
|
+
return `# Migration Checklist: Docker Compose → Render
|
|
70
|
+
|
|
71
|
+
## Pre-Migration
|
|
72
|
+
|
|
73
|
+
- [ ] Review docker-compose.yml
|
|
74
|
+
- [ ] Ensure Dockerfile works standalone
|
|
75
|
+
- [ ] List all services and their dependencies
|
|
76
|
+
- [ ] Document environment variables
|
|
77
|
+
|
|
78
|
+
## Render Setup
|
|
79
|
+
|
|
80
|
+
- [ ] Create Render account at https://render.com
|
|
81
|
+
- [ ] Connect GitHub/GitLab repository
|
|
82
|
+
|
|
83
|
+
## Blueprint Deployment
|
|
84
|
+
|
|
85
|
+
### Option 1: Using render.yaml (Recommended)
|
|
86
|
+
- [ ] Copy render.yaml to project root
|
|
87
|
+
- [ ] Customize services in render.yaml
|
|
88
|
+
- [ ] Push to repository
|
|
89
|
+
- [ ] In Render: New → Blueprint → Select repo
|
|
90
|
+
|
|
91
|
+
### Option 2: Manual Setup
|
|
92
|
+
- [ ] Create Web Service in Render dashboard
|
|
93
|
+
- [ ] Connect repository
|
|
94
|
+
- [ ] Set Docker environment
|
|
95
|
+
- [ ] Configure environment variables
|
|
96
|
+
|
|
97
|
+
## Service Migration
|
|
98
|
+
|
|
99
|
+
### Main Application
|
|
100
|
+
- [ ] Verify Dockerfile builds correctly
|
|
101
|
+
- [ ] Set environment variables
|
|
102
|
+
- [ ] Configure health check path
|
|
103
|
+
|
|
104
|
+
### PostgreSQL
|
|
105
|
+
- [ ] Create PostgreSQL in Render
|
|
106
|
+
- [ ] Update DATABASE_URL env var
|
|
107
|
+
- [ ] Migrate data from local/compose database
|
|
108
|
+
|
|
109
|
+
### Redis
|
|
110
|
+
- [ ] Create Redis in Render
|
|
111
|
+
- [ ] Update REDIS_URL env var
|
|
112
|
+
|
|
113
|
+
### Other Services
|
|
114
|
+
- [ ] Review any other services in compose
|
|
115
|
+
- [ ] Create equivalent Render services or use alternatives
|
|
116
|
+
|
|
117
|
+
## Environment Variables
|
|
118
|
+
|
|
119
|
+
Render provides references between services:
|
|
120
|
+
|
|
121
|
+
\`\`\`yaml
|
|
122
|
+
envVars:
|
|
123
|
+
- key: DATABASE_URL
|
|
124
|
+
fromDatabase:
|
|
125
|
+
name: my-db
|
|
126
|
+
property: connectionString
|
|
127
|
+
\`\`\`
|
|
128
|
+
|
|
129
|
+
## Persistent Data
|
|
130
|
+
|
|
131
|
+
- [ ] Database data: Use Render managed databases
|
|
132
|
+
- [ ] File uploads: Use Render Disk or S3
|
|
133
|
+
- [ ] Logs: Available in Render dashboard
|
|
134
|
+
|
|
135
|
+
## Custom Domain
|
|
136
|
+
|
|
137
|
+
- [ ] Add custom domain in Render settings
|
|
138
|
+
- [ ] Update DNS (CNAME to *.onrender.com)
|
|
139
|
+
- [ ] SSL is automatic
|
|
140
|
+
|
|
141
|
+
## Post-Migration
|
|
142
|
+
|
|
143
|
+
- [ ] Verify all endpoints
|
|
144
|
+
- [ ] Check logs in dashboard
|
|
145
|
+
- [ ] Monitor performance
|
|
146
|
+
- [ ] Remove local docker-compose setup if no longer needed
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MigrationOptions } from "../form";
|
|
2
|
+
interface MigrationPath {
|
|
3
|
+
from: string;
|
|
4
|
+
to: string;
|
|
5
|
+
description: string;
|
|
6
|
+
complexity: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateGenericMigration(outputDir: string, options: MigrationOptions, migration?: MigrationPath): Promise<void>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateGenericMigration = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
async function generateGenericMigration(outputDir, options, migration) {
|
|
11
|
+
console.log(chalk_1.default.yellow(` Generating ${options.from} → ${options.to} migration...`));
|
|
12
|
+
// Generate generic checklist
|
|
13
|
+
const checklist = generateGenericChecklist(options, migration);
|
|
14
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "MIGRATION_CHECKLIST.md"), checklist, "utf-8");
|
|
15
|
+
console.log(chalk_1.default.green(" ✓ Created MIGRATION_CHECKLIST.md"));
|
|
16
|
+
// Generate environment mapping template
|
|
17
|
+
const envMapping = generateEnvMappingTemplate(options);
|
|
18
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "env-mapping.md"), envMapping, "utf-8");
|
|
19
|
+
console.log(chalk_1.default.green(" ✓ Created env-mapping.md"));
|
|
20
|
+
// Generate migration notes
|
|
21
|
+
const notes = generateMigrationNotes(options, migration);
|
|
22
|
+
fs_1.default.writeFileSync(path_1.default.join(outputDir, "MIGRATION_NOTES.md"), notes, "utf-8");
|
|
23
|
+
console.log(chalk_1.default.green(" ✓ Created MIGRATION_NOTES.md"));
|
|
24
|
+
}
|
|
25
|
+
exports.generateGenericMigration = generateGenericMigration;
|
|
26
|
+
function generateGenericChecklist(options, migration) {
|
|
27
|
+
const complexity = migration?.complexity || "medium";
|
|
28
|
+
return `# Migration Checklist: ${options.from} → ${options.to}
|
|
29
|
+
|
|
30
|
+
**Complexity**: ${complexity}
|
|
31
|
+
|
|
32
|
+
## Pre-Migration
|
|
33
|
+
|
|
34
|
+
- [ ] Document current infrastructure configuration
|
|
35
|
+
- [ ] Export all environment variables
|
|
36
|
+
- [ ] Backup databases and persistent data
|
|
37
|
+
- [ ] Document current DNS configuration
|
|
38
|
+
- [ ] List all external service dependencies
|
|
39
|
+
|
|
40
|
+
## Target Platform Setup
|
|
41
|
+
|
|
42
|
+
- [ ] Create account on ${options.to}
|
|
43
|
+
- [ ] Set up CLI tools if available
|
|
44
|
+
- [ ] Configure authentication
|
|
45
|
+
- [ ] Create new project/application
|
|
46
|
+
|
|
47
|
+
## Application Migration
|
|
48
|
+
|
|
49
|
+
- [ ] Prepare application configuration for ${options.to}
|
|
50
|
+
- [ ] Update build scripts if necessary
|
|
51
|
+
- [ ] Configure deployment pipeline
|
|
52
|
+
- [ ] Set up environment variables
|
|
53
|
+
|
|
54
|
+
## Database Migration
|
|
55
|
+
|
|
56
|
+
- [ ] Provision database on ${options.to}
|
|
57
|
+
- [ ] Export data from source database
|
|
58
|
+
- [ ] Import data to target database
|
|
59
|
+
- [ ] Verify data integrity
|
|
60
|
+
- [ ] Update DATABASE_URL configuration
|
|
61
|
+
|
|
62
|
+
## Networking & DNS
|
|
63
|
+
|
|
64
|
+
- [ ] Configure custom domain on ${options.to}
|
|
65
|
+
- [ ] Set up SSL/TLS certificates
|
|
66
|
+
- [ ] Update DNS records
|
|
67
|
+
- [ ] Verify domain propagation
|
|
68
|
+
|
|
69
|
+
## Testing
|
|
70
|
+
|
|
71
|
+
- [ ] Deploy to staging environment
|
|
72
|
+
- [ ] Run integration tests
|
|
73
|
+
- [ ] Verify all API endpoints
|
|
74
|
+
- [ ] Test database connectivity
|
|
75
|
+
- [ ] Check external service integrations
|
|
76
|
+
|
|
77
|
+
## Go-Live
|
|
78
|
+
|
|
79
|
+
- [ ] Schedule maintenance window
|
|
80
|
+
- [ ] Deploy to production
|
|
81
|
+
- [ ] Update DNS to point to new platform
|
|
82
|
+
- [ ] Monitor for 24-48 hours
|
|
83
|
+
- [ ] Verify all functionality
|
|
84
|
+
|
|
85
|
+
## Post-Migration
|
|
86
|
+
|
|
87
|
+
- [ ] Document new infrastructure
|
|
88
|
+
- [ ] Update team runbooks
|
|
89
|
+
- [ ] Decommission old infrastructure
|
|
90
|
+
- [ ] Update monitoring and alerts
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
function generateEnvMappingTemplate(options) {
|
|
94
|
+
return `# Environment Variable Mapping: ${options.from} → ${options.to}
|
|
95
|
+
|
|
96
|
+
## Instructions
|
|
97
|
+
|
|
98
|
+
1. Export environment variables from ${options.from}
|
|
99
|
+
2. Map them to ${options.to} equivalents
|
|
100
|
+
3. Set up variables on the new platform
|
|
101
|
+
|
|
102
|
+
## Variable Template
|
|
103
|
+
|
|
104
|
+
| Source Variable | Target Variable | Value/Reference | Notes |
|
|
105
|
+
|-----------------|-----------------|-----------------|-------|
|
|
106
|
+
| DATABASE_URL | DATABASE_URL | | Connection string |
|
|
107
|
+
| REDIS_URL | REDIS_URL | | Cache connection |
|
|
108
|
+
| NODE_ENV | NODE_ENV | production | |
|
|
109
|
+
| PORT | PORT | 3000 | May be set automatically |
|
|
110
|
+
| API_KEY | API_KEY | | Secret |
|
|
111
|
+
| | | | |
|
|
112
|
+
|
|
113
|
+
## Platform-Specific Variables
|
|
114
|
+
|
|
115
|
+
Some platforms inject their own variables. Check ${options.to} documentation for:
|
|
116
|
+
|
|
117
|
+
- Automatic PORT assignment
|
|
118
|
+
- Database connection strings
|
|
119
|
+
- Service discovery variables
|
|
120
|
+
- Platform metadata
|
|
121
|
+
|
|
122
|
+
## Secrets Management
|
|
123
|
+
|
|
124
|
+
Consider using a secrets manager:
|
|
125
|
+
- AWS Secrets Manager
|
|
126
|
+
- HashiCorp Vault
|
|
127
|
+
- Doppler
|
|
128
|
+
- 1Password Secrets
|
|
129
|
+
|
|
130
|
+
## Exporting from ${options.from}
|
|
131
|
+
|
|
132
|
+
\`\`\`bash
|
|
133
|
+
# Example commands - adjust for your source platform
|
|
134
|
+
# Heroku
|
|
135
|
+
heroku config --app your-app --shell > .env.backup
|
|
136
|
+
|
|
137
|
+
# Docker Compose
|
|
138
|
+
docker-compose config | grep -A 100 environment > env-backup.txt
|
|
139
|
+
|
|
140
|
+
# Kubernetes
|
|
141
|
+
kubectl get configmap your-config -o yaml > configmap-backup.yaml
|
|
142
|
+
kubectl get secret your-secret -o yaml > secret-backup.yaml
|
|
143
|
+
\`\`\`
|
|
144
|
+
`;
|
|
145
|
+
}
|
|
146
|
+
function generateMigrationNotes(options, migration) {
|
|
147
|
+
return `# Migration Notes: ${options.from} → ${options.to}
|
|
148
|
+
|
|
149
|
+
## Overview
|
|
150
|
+
|
|
151
|
+
This document contains notes and considerations for migrating from ${options.from} to ${options.to}.
|
|
152
|
+
|
|
153
|
+
${migration
|
|
154
|
+
? `
|
|
155
|
+
**Complexity**: ${migration.complexity}
|
|
156
|
+
**Description**: ${migration.description}
|
|
157
|
+
`
|
|
158
|
+
: ""}
|
|
159
|
+
|
|
160
|
+
## Key Differences
|
|
161
|
+
|
|
162
|
+
### Compute Model
|
|
163
|
+
Document the differences in compute model between platforms:
|
|
164
|
+
- Containers vs VMs vs Serverless
|
|
165
|
+
- Scaling approach
|
|
166
|
+
- Cold start behavior
|
|
167
|
+
|
|
168
|
+
### Networking
|
|
169
|
+
- How services communicate
|
|
170
|
+
- Load balancing
|
|
171
|
+
- SSL/TLS handling
|
|
172
|
+
|
|
173
|
+
### Storage
|
|
174
|
+
- Persistent storage options
|
|
175
|
+
- Database services
|
|
176
|
+
- File storage
|
|
177
|
+
|
|
178
|
+
### Deployment
|
|
179
|
+
- CI/CD integration
|
|
180
|
+
- Rollback mechanisms
|
|
181
|
+
- Blue-green deployments
|
|
182
|
+
|
|
183
|
+
## Potential Issues
|
|
184
|
+
|
|
185
|
+
1. **Platform-specific features**: Some features from ${options.from} may not exist on ${options.to}
|
|
186
|
+
2. **Performance differences**: Initial performance may differ
|
|
187
|
+
3. **Cost structure**: Pricing models may be different
|
|
188
|
+
4. **Vendor lock-in**: Watch for platform-specific services
|
|
189
|
+
|
|
190
|
+
## Resources
|
|
191
|
+
|
|
192
|
+
- ${options.to} documentation
|
|
193
|
+
- Migration guides
|
|
194
|
+
- Community forums
|
|
195
|
+
- Support channels
|
|
196
|
+
|
|
197
|
+
## Rollback Plan
|
|
198
|
+
|
|
199
|
+
If migration fails:
|
|
200
|
+
|
|
201
|
+
1. Revert DNS to original platform
|
|
202
|
+
2. Re-enable ${options.from} services
|
|
203
|
+
3. Investigate issues
|
|
204
|
+
4. Plan remediation
|
|
205
|
+
5. Retry migration
|
|
206
|
+
|
|
207
|
+
## Timeline Estimate
|
|
208
|
+
|
|
209
|
+
- Preparation: 1-2 days
|
|
210
|
+
- Migration: 1-4 hours (depending on complexity)
|
|
211
|
+
- Monitoring: 24-48 hours
|
|
212
|
+
- Cleanup: 1 day
|
|
213
|
+
|
|
214
|
+
## Sign-off
|
|
215
|
+
|
|
216
|
+
- [ ] Development team reviewed
|
|
217
|
+
- [ ] Operations team reviewed
|
|
218
|
+
- [ ] Stakeholders notified
|
|
219
|
+
- [ ] Rollback plan tested
|
|
220
|
+
`;
|
|
221
|
+
}
|