feat: support publishing

This commit is contained in:
decentral1se 2021-10-11 01:34:03 +02:00
parent e45615b4a6
commit e4d777fac6
No known key found for this signature in database
GPG key ID: 5E2EF5A63E3718CC
4 changed files with 109 additions and 1 deletions

38
compose.yml Normal file
View file

@ -0,0 +1,38 @@
---
version: "3.8"
services:
app:
image: "nginx:stable"
configs:
- source: abra_conf
target: /etc/nginx/conf.d/default.conf
- source: abra_recipes_json
target: /var/www/recipes/recipes.json
volumes:
- "public:/var/www/recipes"
networks:
- proxy
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.services.recipes.loadbalancer.server.port=80"
- "traefik.http.routers.recipes.rule=Host(`apps.coopcloud.tech`, `recipes.coopcloud.tech`)"
- "traefik.http.routers.recipes.entrypoints=web-secure"
- "traefik.http.routers.recipes.tls.certresolver=production"
configs:
abra_apps_json:
file: recipes.json
abra_conf:
file: nginx.conf
networks:
proxy:
external: true
volumes:
public:

12
makefile Normal file
View file

@ -0,0 +1,12 @@
STACK := recipes_coopcloud_tech
default: deploy
generate:
abra catalogue generate && cp ~/.abra/apps.json recipes.json
deploy:
@DOCKER_CONTEXT=swarm.autonomic.zone docker stack rm $(STACK) && \
DOCKER_CONTEXT=swarm.autonomic.zone docker stack deploy -c compose.yml $(STACK)
.PHONY: generate deploy

39
nginx.conf Normal file
View file

@ -0,0 +1,39 @@
server {
listen 80 default_server;
server_name apps.coopcloud.tech recipes.coopcloud.tech;
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}
add_header Content-Type application/json;
root /var/www/recipes;
index recipes.json;
}
}

View file

@ -901,7 +901,26 @@
"icon": "https://git.coopcloud.tech/repo-avatars/186-86a30915fd46fce2d7e35709d9373da4", "icon": "https://git.coopcloud.tech/repo-avatars/186-86a30915fd46fce2d7e35709d9373da4",
"name": "keyoxide", "name": "keyoxide",
"repository": "https://git.coopcloud.tech/coop-cloud/keyoxide.git", "repository": "https://git.coopcloud.tech/coop-cloud/keyoxide.git",
"versions": [], "versions": [
{
"1.0.0+2.5.0": {
"app": {
"digest": "aa23f35",
"image": "keyoxide/keyoxide",
"tag": "2.5.0"
}
}
},
{
"2.0.0+3.0.0": {
"app": {
"digest": "74e29a7",
"image": "keyoxide/keyoxide",
"tag": "3.0.0"
}
}
}
],
"website": "https://codeberg.org/keyoxide/web" "website": "https://codeberg.org/keyoxide/web"
}, },
"kimai": { "kimai": {