@cloudgrid-io/cli 0.3.0

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 (33) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +2094 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +43 -0
  5. package/shared-services.yaml +14 -0
  6. package/templates/CLOUDGRID.md +94 -0
  7. package/templates/dockerfiles/cron.Dockerfile +7 -0
  8. package/templates/dockerfiles/nextjs.Dockerfile +17 -0
  9. package/templates/dockerfiles/node.Dockerfile +8 -0
  10. package/templates/dockerfiles/python.Dockerfile +8 -0
  11. package/templates/dockerfiles/static.Dockerfile +4 -0
  12. package/templates/dockerfiles/static.nginx.conf +12 -0
  13. package/templates/dockerfiles/typescript.Dockerfile +10 -0
  14. package/templates/samples/full-stack.yaml +11 -0
  15. package/templates/samples/multi-service.yaml +14 -0
  16. package/templates/samples/node-api.yaml +7 -0
  17. package/templates/samples/python-worker.yaml +9 -0
  18. package/templates/samples/static-site.yaml +5 -0
  19. package/templates/stubs/cron.stub.js +14 -0
  20. package/templates/stubs/cron.stub.package.json +9 -0
  21. package/templates/stubs/nextjs.stub/next.config.js +5 -0
  22. package/templates/stubs/nextjs.stub/package.json +15 -0
  23. package/templates/stubs/nextjs.stub/src/app/health/route.js +3 -0
  24. package/templates/stubs/nextjs.stub/src/app/layout.js +4 -0
  25. package/templates/stubs/nextjs.stub/src/app/page.js +3 -0
  26. package/templates/stubs/node.stub.js +13 -0
  27. package/templates/stubs/node.stub.package.json +12 -0
  28. package/templates/stubs/python.stub.py +16 -0
  29. package/templates/stubs/python.stub.requirements.txt +2 -0
  30. package/templates/stubs/static.stub/index.html +8 -0
  31. package/templates/stubs/typescript.stub.package.json +19 -0
  32. package/templates/stubs/typescript.stub.ts +14 -0
  33. package/templates/stubs/typescript.stub.tsconfig.json +12 -0
@@ -0,0 +1,10 @@
1
+ FROM node:22-alpine
2
+ WORKDIR /app
3
+ COPY package.json package-lock.json* tsconfig.json ./
4
+ RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi
5
+ COPY src/ src/
6
+ RUN npm run build
7
+ RUN npm prune --production
8
+ USER node
9
+ EXPOSE 8080
10
+ CMD ["node", "dist/index.js"]
@@ -0,0 +1,11 @@
1
+ name: __APP_NAME__
2
+ services:
3
+ dashboard:
4
+ type: nextjs
5
+ path: /
6
+ api:
7
+ type: node
8
+ path: /api
9
+ requires:
10
+ - mongodb
11
+ - redis: private
@@ -0,0 +1,14 @@
1
+ name: __APP_NAME__
2
+ services:
3
+ frontend:
4
+ type: nextjs
5
+ path: /
6
+ api:
7
+ type: node
8
+ path: /api
9
+ sync-worker:
10
+ type: node
11
+ requires:
12
+ - mongodb
13
+ - redis
14
+ - n8n
@@ -0,0 +1,7 @@
1
+ name: __APP_NAME__
2
+ services:
3
+ api:
4
+ type: node
5
+ path: /
6
+ requires:
7
+ - mongodb
@@ -0,0 +1,9 @@
1
+ name: __APP_NAME__
2
+ services:
3
+ api:
4
+ type: python
5
+ path: /
6
+ worker:
7
+ type: python
8
+ requires:
9
+ - redis: private
@@ -0,0 +1,5 @@
1
+ name: __APP_NAME__
2
+ services:
3
+ web:
4
+ type: static
5
+ path: /
@@ -0,0 +1,14 @@
1
+ async function run() {
2
+ console.log('Job started:', new Date().toISOString());
3
+
4
+ // Your job logic here
5
+ // Access MongoDB via process.env.MONGODB_URL
6
+ // Access Redis via process.env.REDIS_URL
7
+
8
+ console.log('Job completed');
9
+ }
10
+
11
+ run().catch((err) => {
12
+ console.error('Job failed:', err);
13
+ process.exit(1);
14
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "__APP_NAME__-__SERVICE_NAME__",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "node src/job.js"
7
+ },
8
+ "dependencies": {}
9
+ }
@@ -0,0 +1,5 @@
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ output: 'standalone',
4
+ };
5
+ module.exports = nextConfig;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "__APP_NAME__-__SERVICE_NAME__",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev -p 8080",
7
+ "build": "next build",
8
+ "start": "next start -p 8080"
9
+ },
10
+ "dependencies": {
11
+ "next": "^15.0.0",
12
+ "react": "^19.0.0",
13
+ "react-dom": "^19.0.0"
14
+ }
15
+ }
@@ -0,0 +1,3 @@
1
+ export async function GET() {
2
+ return Response.json({ status: 'ok' });
3
+ }
@@ -0,0 +1,4 @@
1
+ export const metadata = { title: '__APP_NAME__' };
2
+ export default function RootLayout({ children }) {
3
+ return <html><body>{children}</body></html>;
4
+ }
@@ -0,0 +1,3 @@
1
+ export default function Home() {
2
+ return <div><h1>__APP_NAME__ — __SERVICE_NAME__</h1><p>Edit this page to get started.</p></div>;
3
+ }
@@ -0,0 +1,13 @@
1
+ const express = require('express');
2
+ const app = express();
3
+ const port = process.env.PORT || 8080;
4
+
5
+ app.use(express.json());
6
+
7
+ app.get('/health', (req, res) => res.json({ status: 'ok' }));
8
+
9
+ app.get('/', (req, res) => res.json({ message: 'Hello from __SERVICE_NAME__' }));
10
+
11
+ app.listen(port, '0.0.0.0', () => {
12
+ console.log(`__SERVICE_NAME__ listening on port ${port}`);
13
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "__APP_NAME__-__SERVICE_NAME__",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "node src/index.js",
7
+ "dev": "node --watch src/index.js"
8
+ },
9
+ "dependencies": {
10
+ "express": "^4.21.0"
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ import os
2
+ from flask import Flask, jsonify
3
+
4
+ app = Flask(__name__)
5
+ port = int(os.environ.get('PORT', 8080))
6
+
7
+ @app.route('/health')
8
+ def health():
9
+ return jsonify(status='ok')
10
+
11
+ @app.route('/')
12
+ def index():
13
+ return jsonify(message='Hello from __SERVICE_NAME__')
14
+
15
+ if __name__ == '__main__':
16
+ app.run(host='0.0.0.0', port=port)
@@ -0,0 +1,2 @@
1
+ flask>=3.0.0
2
+ gunicorn>=21.2.0
@@ -0,0 +1,8 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head><title>__APP_NAME__</title></head>
4
+ <body>
5
+ <h1>__APP_NAME__ — __SERVICE_NAME__</h1>
6
+ <p>Replace this with your static content.</p>
7
+ </body>
8
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "__APP_NAME__-__SERVICE_NAME__",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "node dist/index.js",
7
+ "dev": "tsx watch src/index.ts",
8
+ "build": "tsc"
9
+ },
10
+ "dependencies": {
11
+ "express": "^4.21.0"
12
+ },
13
+ "devDependencies": {
14
+ "typescript": "^5.7.0",
15
+ "tsx": "^4.0.0",
16
+ "@types/express": "^4.17.0",
17
+ "@types/node": "^22.0.0"
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ import express from 'express';
2
+
3
+ const app = express();
4
+ const port = process.env.PORT || 8080;
5
+
6
+ app.use(express.json());
7
+
8
+ app.get('/health', (req, res) => res.json({ status: 'ok' }));
9
+
10
+ app.get('/', (req, res) => res.json({ message: 'Hello from __SERVICE_NAME__' }));
11
+
12
+ app.listen(Number(port), '0.0.0.0', () => {
13
+ console.log(`__SERVICE_NAME__ listening on port ${port}`);
14
+ });
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "commonjs",
5
+ "outDir": "dist",
6
+ "rootDir": "src",
7
+ "strict": true,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true
10
+ },
11
+ "include": ["src/**/*"]
12
+ }