From e4d777fac672b2f7d2e05f08f98466eb91fa3d57 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Mon, 11 Oct 2021 01:34:03 +0200 Subject: [PATCH] feat: support publishing --- compose.yml | 38 ++++++++++++++++++++++++++++++++++++++ makefile | 12 ++++++++++++ nginx.conf | 39 +++++++++++++++++++++++++++++++++++++++ recipes.json | 21 ++++++++++++++++++++- 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 compose.yml create mode 100644 makefile create mode 100644 nginx.conf diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..878040e --- /dev/null +++ b/compose.yml @@ -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: diff --git a/makefile b/makefile new file mode 100644 index 0000000..c19f70d --- /dev/null +++ b/makefile @@ -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 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..d113657 --- /dev/null +++ b/nginx.conf @@ -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; + } +} diff --git a/recipes.json b/recipes.json index 0aa3a16..83849e6 100644 --- a/recipes.json +++ b/recipes.json @@ -901,7 +901,26 @@ "icon": "https://git.coopcloud.tech/repo-avatars/186-86a30915fd46fce2d7e35709d9373da4", "name": "keyoxide", "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" }, "kimai": {