-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.js
More file actions
79 lines (66 loc) · 2.64 KB
/
deploy.js
File metadata and controls
79 lines (66 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env node
/**
* This is a simple deployment script to help prepare the Aniexo project for production.
* It provides instructions and guidance for building and deploying the application.
*/
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
function log(message) {
console.log(`[Deploy] ${message}`);
}
function checkPrerequisites() {
log('Checking prerequisites...');
// Check if the build script exists
const buildScriptPath = path.join(__dirname, 'build-for-deployment.js');
if (!fs.existsSync(buildScriptPath)) {
log('ERROR: build-for-deployment.js script is missing');
return false;
}
// Check if render.yaml exists
const renderYamlPath = path.join(__dirname, 'render.yaml');
if (!fs.existsSync(renderYamlPath)) {
log('ERROR: render.yaml configuration file is missing');
return false;
}
log('All prerequisites are met!');
return true;
}
function printDeploymentInstructions() {
log('\n=====================================================');
log('DEPLOYMENT INSTRUCTIONS FOR ANIEXO');
log('=====================================================');
log('\n1. Build the application for production:');
log(' $ node build-for-deployment.js');
log('\n2. Deploy to Render:');
log(' - Push your code to a Git repository (GitHub, GitLab, etc.)');
log(' - Log in to your Render account: https://dashboard.render.com/');
log(' - Click "New+" and select "Blueprint"');
log(' - Connect your Git repository');
log(' - Render will detect the render.yaml file and set up your services');
log('\n3. Environment Variables to Set in Render:');
log(' - NODE_ENV: production');
log(' - DATABASE_URL: (Will be automatically set if using Render\'s database)');
log('\n4. Important Notes:');
log(' - The application will be built using the scripts in package.json');
log(' - The database will be automatically provisioned if using Render\'s database');
log(' - The application will be served on port 8080 or the PORT environment variable');
log('\n=====================================================');
log('For more information, visit: https://render.com/docs/deploy-node-express-app');
log('=====================================================\n');
}
async function main() {
log('Starting Aniexo deployment guide...');
// Check prerequisites
if (!checkPrerequisites()) {
process.exit(1);
}
// Print deployment instructions
printDeploymentInstructions();
}
main().catch(error => {
console.error('Error:', error);
process.exit(1);
});