Add Railway deployment configuration and Express server setup
Co-authored-by: blackboxprogramming <118287761+blackboxprogramming@users.noreply.github.com>
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules/
|
||||||
|
npm-debug.log
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.DS_Store
|
||||||
78
README.md
78
README.md
@@ -1 +1,79 @@
|
|||||||
# blackroad-os-pack-creator-studio
|
# blackroad-os-pack-creator-studio
|
||||||
|
|
||||||
|
A service for creating and managing OS packs in the BlackRoad OS ecosystem.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
BlackRoad OS Pack Creator Studio provides tools and APIs for creating, editing, and managing OS packs for the BlackRoad OS platform.
|
||||||
|
|
||||||
|
## Local Development
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Node.js >= 18.0.0
|
||||||
|
- npm
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running Locally
|
||||||
|
|
||||||
|
Development mode with auto-reload:
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Production mode:
|
||||||
|
```bash
|
||||||
|
npm run start:studio
|
||||||
|
```
|
||||||
|
|
||||||
|
The service will start on port 8080 by default (or the port specified in the `PORT` environment variable).
|
||||||
|
|
||||||
|
## Build & Deploy
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
This project uses Nixpacks for building on Railway. No build step is required for JavaScript.
|
||||||
|
|
||||||
|
### Deployment
|
||||||
|
|
||||||
|
The service is configured to deploy to Railway using the `railway.toml` configuration file.
|
||||||
|
|
||||||
|
Deploy command:
|
||||||
|
```bash
|
||||||
|
npm run start:studio
|
||||||
|
```
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
|
| Variable | Description | Default |
|
||||||
|
|----------|-------------|---------|
|
||||||
|
| `PORT` | Port the server listens on | `8080` |
|
||||||
|
| `SERVICE_NAME` | Name of the service | `blackroad-os-pack-creator-studio` |
|
||||||
|
| `ENVIRONMENT` | Deployment environment | `production` |
|
||||||
|
|
||||||
|
## Healthcheck
|
||||||
|
|
||||||
|
The health endpoint is available at `/health` and returns:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"status": "ok",
|
||||||
|
"service": "blackroad-os-pack-creator-studio"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
| Method | Endpoint | Description |
|
||||||
|
|--------|----------|-------------|
|
||||||
|
| GET | `/` | Service information |
|
||||||
|
| GET | `/health` | Health check endpoint |
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
1212
package-lock.json
generated
Normal file
1212
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
package.json
Normal file
29
package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "blackroad-os-pack-creator-studio",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "BlackRoad OS Pack Creator Studio - A service for creating and managing OS packs",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start:studio": "node src/index.js",
|
||||||
|
"dev": "nodemon src/index.js",
|
||||||
|
"start": "node src/index.js"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"blackroad",
|
||||||
|
"os",
|
||||||
|
"pack",
|
||||||
|
"creator",
|
||||||
|
"studio"
|
||||||
|
],
|
||||||
|
"author": "BlackRoad OS Team",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.18.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^3.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
13
railway.toml
Normal file
13
railway.toml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[build]
|
||||||
|
builder = "NIXPACKS"
|
||||||
|
|
||||||
|
[deploy]
|
||||||
|
startCommand = "npm run start:studio"
|
||||||
|
healthcheckPath = "/health"
|
||||||
|
restartPolicy = "on-failure"
|
||||||
|
maxRetries = 5
|
||||||
|
|
||||||
|
[variables]
|
||||||
|
SERVICE_NAME = "blackroad-os-pack-creator-studio"
|
||||||
|
PORT = "8080"
|
||||||
|
ENVIRONMENT = "production"
|
||||||
27
src/index.js
Normal file
27
src/index.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const healthRoutes = require('./routes/health');
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const PORT = process.env.PORT || 8080;
|
||||||
|
|
||||||
|
// Middleware
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
// Routes
|
||||||
|
app.use('/health', healthRoutes);
|
||||||
|
|
||||||
|
// Root endpoint
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.json({
|
||||||
|
service: 'blackroad-os-pack-creator-studio',
|
||||||
|
version: '1.0.0',
|
||||||
|
status: 'running'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start server
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`blackroad-os-pack-creator-studio is running on port ${PORT}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = app;
|
||||||
11
src/routes/health.js
Normal file
11
src/routes/health.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
router.get('/', (req, res) => {
|
||||||
|
res.json({
|
||||||
|
status: 'ok',
|
||||||
|
service: 'blackroad-os-pack-creator-studio'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
Reference in New Issue
Block a user