Initial demo setup for Komodo + Gitea integration
Added: - Simple Express.js app with health endpoint - Dockerfile for containerization - Docker Compose configuration - Komodo resource definitions (.komodo/resources.toml) - Comprehensive README with integration details This repo demonstrates Build, Stack, and Sync resources.
This commit is contained in:
52
.komodo/resources.toml
Normal file
52
.komodo/resources.toml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
[[build]]
|
||||||
|
name = "komodo-demo-build"
|
||||||
|
description = "Build Docker image for komodo-demo app"
|
||||||
|
tags = ["demo", "gitea"]
|
||||||
|
|
||||||
|
[build.config]
|
||||||
|
# Repo configuration
|
||||||
|
git_provider = "gitea.straymoog.xyz"
|
||||||
|
git_account = "stray"
|
||||||
|
repo = "stray/komodo-demo"
|
||||||
|
branch = "main"
|
||||||
|
|
||||||
|
# Build configuration
|
||||||
|
build_path = "."
|
||||||
|
dockerfile_path = "Dockerfile"
|
||||||
|
|
||||||
|
# Image configuration
|
||||||
|
image_registry = "local"
|
||||||
|
image_name = "komodo-demo-app"
|
||||||
|
image_tag = "latest"
|
||||||
|
|
||||||
|
[[stack]]
|
||||||
|
name = "komodo-demo-stack"
|
||||||
|
description = "Deploy komodo-demo app using docker-compose"
|
||||||
|
tags = ["demo", "gitea"]
|
||||||
|
|
||||||
|
[stack.config]
|
||||||
|
# Use compose file from git repo
|
||||||
|
[stack.config.repo]
|
||||||
|
git_provider = "gitea.straymoog.xyz"
|
||||||
|
git_account = "stray"
|
||||||
|
repo = "stray/komodo-demo"
|
||||||
|
branch = "main"
|
||||||
|
path = "docker-compose.yml"
|
||||||
|
|
||||||
|
# Or optionally, define inline compose content
|
||||||
|
# file_contents = '''
|
||||||
|
# ... compose yaml here ...
|
||||||
|
# '''
|
||||||
|
|
||||||
|
[[sync]]
|
||||||
|
name = "komodo-demo-sync"
|
||||||
|
description = "Sync Komodo resources from Git"
|
||||||
|
tags = ["demo", "gitea"]
|
||||||
|
|
||||||
|
[sync.config]
|
||||||
|
git_provider = "gitea.straymoog.xyz"
|
||||||
|
git_account = "stray"
|
||||||
|
repo = "stray/komodo-demo"
|
||||||
|
branch = "main"
|
||||||
|
resource_path = ".komodo"
|
||||||
|
commit_to_repo = false
|
||||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm install --production
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
||||||
45
README.md
45
README.md
@@ -1,3 +1,44 @@
|
|||||||
# komodo-demo
|
# Komodo + Gitea Integration Demo
|
||||||
|
|
||||||
Demo repository for Komodo integration with Gitea
|
This repository demonstrates the integration between Komodo and Gitea.
|
||||||
|
|
||||||
|
## What's Included
|
||||||
|
|
||||||
|
### Application
|
||||||
|
- **app.js**: Simple Express.js web server
|
||||||
|
- **package.json**: Node.js dependencies
|
||||||
|
- **Dockerfile**: Container build configuration
|
||||||
|
|
||||||
|
### Docker Compose
|
||||||
|
- **docker-compose.yml**: Stack deployment configuration
|
||||||
|
|
||||||
|
### Komodo Configuration
|
||||||
|
- **.komodo/resources.toml**: Komodo resource definitions
|
||||||
|
- **Build**: Builds Docker image from Dockerfile
|
||||||
|
- **Stack**: Deploys app using docker-compose
|
||||||
|
- **Sync**: Syncs Komodo resources from Git
|
||||||
|
|
||||||
|
## Integration Features
|
||||||
|
|
||||||
|
1. **Webhook-Driven Builds**: Push to `main` branch triggers automatic Docker image build
|
||||||
|
2. **Automated Deployment**: Built images can be automatically deployed via Stack resource
|
||||||
|
3. **GitOps Configuration**: Manage Komodo resources in Git using Resource Sync
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
- `GET /`: Returns app info and timestamp
|
||||||
|
- `GET /health`: Health check endpoint
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
1. Configure Gitea access token in Komodo
|
||||||
|
2. Create Build, Stack, and Sync resources in Komodo
|
||||||
|
3. Set up webhooks in Gitea pointing to Komodo
|
||||||
|
4. Push changes to trigger automation
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Push changes to the repository and watch Komodo:
|
||||||
|
- Build the Docker image
|
||||||
|
- Deploy the updated stack
|
||||||
|
- Sync configuration changes
|
||||||
|
|||||||
19
app.js
Normal file
19
app.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const PORT = process.env.PORT || 3000;
|
||||||
|
|
||||||
|
app.get('/', (req, res) => {
|
||||||
|
res.json({
|
||||||
|
message: 'Hello from Komodo Demo!',
|
||||||
|
version: '1.0.0',
|
||||||
|
timestamp: new Date().toISOString()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/health', (req, res) => {
|
||||||
|
res.json({ status: 'healthy' });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Komodo demo app running on port ${PORT}`);
|
||||||
|
});
|
||||||
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: komodo-demo-app:latest
|
||||||
|
container_name: komodo-demo-app
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- NODE_ENV=production
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
12
package.json
Normal file
12
package.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "komodo-demo-app",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Demo app for Komodo + Gitea integration",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.18.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user