Switch CI/CD to Gitea Actions and Gitea registry
This commit is contained in:
40
.gitea/workflows/images.yml
Normal file
40
.gitea/workflows/images.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
name: images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
env:
|
||||
REGISTRY: ${{ secrets.GITEA_REGISTRY_HOST }}
|
||||
USERNAME: ${{ secrets.GITEA_REGISTRY_USERNAME }}
|
||||
TOKEN: ${{ secrets.GITEA_REGISTRY_TOKEN }}
|
||||
run: |
|
||||
test -n "$REGISTRY"
|
||||
test -n "$USERNAME"
|
||||
test -n "$TOKEN"
|
||||
echo "$TOKEN" | docker login "$REGISTRY" -u "$USERNAME" --password-stdin
|
||||
|
||||
- name: Build images
|
||||
env:
|
||||
IMAGE_PREFIX: ${{ secrets.GITEA_IMAGE_PREFIX }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
run: |
|
||||
test -n "$IMAGE_PREFIX"
|
||||
sh docker/scripts/build_images.sh all
|
||||
|
||||
- name: Push images
|
||||
env:
|
||||
IMAGE_PREFIX: ${{ secrets.GITEA_IMAGE_PREFIX }}
|
||||
IMAGE_TAG: ${{ github.sha }}
|
||||
run: |
|
||||
test -n "$IMAGE_PREFIX"
|
||||
sh docker/scripts/push_images.sh all
|
||||
19
DOCKER.md
19
DOCKER.md
@@ -33,6 +33,23 @@ Build images:
|
||||
sh docker/scripts/build_images.sh all
|
||||
```
|
||||
|
||||
Build images for the Gitea container registry:
|
||||
|
||||
```bash
|
||||
export IMAGE_PREFIX=git.madapes.com/madapes/cloudlysis
|
||||
export IMAGE_TAG=dev
|
||||
sh docker/scripts/build_images.sh all
|
||||
```
|
||||
|
||||
Push images to the Gitea container registry:
|
||||
|
||||
```bash
|
||||
docker login git.madapes.com
|
||||
export IMAGE_PREFIX=git.madapes.com/madapes/cloudlysis
|
||||
export IMAGE_TAG=dev
|
||||
sh docker/scripts/push_images.sh all
|
||||
```
|
||||
|
||||
Create dev secrets required by the observability stack:
|
||||
|
||||
```bash
|
||||
@@ -42,6 +59,8 @@ sh docker/scripts/swarm_dev_secrets.sh
|
||||
Deploy:
|
||||
|
||||
```bash
|
||||
export IMAGE_PREFIX=cloudlysis
|
||||
export IMAGE_TAG=dev
|
||||
docker stack deploy -c swarm/stacks/platform.yml cloudlysis
|
||||
docker stack deploy -c swarm/stacks/control-plane.yml cloudlysis_control
|
||||
docker stack deploy -c swarm/stacks/observability.yml cloudlysis_obs
|
||||
|
||||
10
Makefile
10
Makefile
@@ -1,4 +1,5 @@
|
||||
.PHONY: docker-build-platform docker-build-control docker-build-observability docker-build-all
|
||||
.PHONY: docker-push-platform docker-push-control docker-push-all
|
||||
.PHONY: compose-up compose-down compose-ps compose-up-observability compose-down-observability
|
||||
.PHONY: swarm-dev-secrets swarm-deploy-platform swarm-deploy-control swarm-deploy-observability swarm-deploy-all
|
||||
.PHONY: swarm-rm-platform swarm-rm-control swarm-rm-observability swarm-rm-all
|
||||
@@ -15,6 +16,15 @@ docker-build-observability:
|
||||
docker-build-all:
|
||||
sh docker/scripts/build_images.sh all
|
||||
|
||||
docker-push-platform:
|
||||
sh docker/scripts/push_images.sh platform
|
||||
|
||||
docker-push-control:
|
||||
sh docker/scripts/push_images.sh control
|
||||
|
||||
docker-push-all:
|
||||
sh docker/scripts/push_images.sh all
|
||||
|
||||
compose-up:
|
||||
docker compose up -d --build
|
||||
|
||||
|
||||
@@ -4,9 +4,12 @@ set -eu
|
||||
mode="${1:-all}"
|
||||
|
||||
build_rust() {
|
||||
image="$1"
|
||||
service="$1"
|
||||
package="$2"
|
||||
bin="$3"
|
||||
prefix="${IMAGE_PREFIX:-cloudlysis}"
|
||||
tag="${IMAGE_TAG:-dev}"
|
||||
image="${prefix}/${service}:${tag}"
|
||||
docker build \
|
||||
-f docker/Dockerfile.rust \
|
||||
--build-arg PACKAGE="$package" \
|
||||
@@ -18,20 +21,23 @@ build_rust() {
|
||||
}
|
||||
|
||||
build_ui() {
|
||||
image="$1"
|
||||
service="$1"
|
||||
prefix="${IMAGE_PREFIX:-cloudlysis}"
|
||||
tag="${IMAGE_TAG:-dev}"
|
||||
image="${prefix}/${service}:${tag}"
|
||||
docker build -f docker/Dockerfile.ui -t "$image" .
|
||||
}
|
||||
|
||||
build_platform() {
|
||||
build_rust cloudlysis/gateway:dev gateway gateway
|
||||
build_rust cloudlysis/aggregate:dev aggregate aggregate
|
||||
build_rust cloudlysis/projection:dev projection projection
|
||||
build_rust cloudlysis/runner:dev runner runner
|
||||
build_rust gateway gateway gateway
|
||||
build_rust aggregate aggregate aggregate
|
||||
build_rust projection projection projection
|
||||
build_rust runner runner runner
|
||||
}
|
||||
|
||||
build_control() {
|
||||
build_rust cloudlysis/control-api:dev api api
|
||||
build_ui cloudlysis/control-ui:dev
|
||||
build_rust control-api api api
|
||||
build_ui control-ui
|
||||
}
|
||||
|
||||
case "$mode" in
|
||||
|
||||
40
docker/scripts/push_images.sh
Normal file
40
docker/scripts/push_images.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
mode="${1:-all}"
|
||||
|
||||
push_image() {
|
||||
service="$1"
|
||||
prefix="${IMAGE_PREFIX:-cloudlysis}"
|
||||
tag="${IMAGE_TAG:-dev}"
|
||||
docker push "${prefix}/${service}:${tag}"
|
||||
}
|
||||
|
||||
push_platform() {
|
||||
push_image gateway
|
||||
push_image aggregate
|
||||
push_image projection
|
||||
push_image runner
|
||||
}
|
||||
|
||||
push_control() {
|
||||
push_image control-api
|
||||
push_image control-ui
|
||||
}
|
||||
|
||||
case "$mode" in
|
||||
platform)
|
||||
push_platform
|
||||
;;
|
||||
control)
|
||||
push_control
|
||||
;;
|
||||
all)
|
||||
push_platform
|
||||
push_control
|
||||
;;
|
||||
*)
|
||||
echo "usage: sh docker/scripts/push_images.sh [platform|control|all]" 1>&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
@@ -2,7 +2,7 @@ version: "3.9"
|
||||
|
||||
services:
|
||||
control-api:
|
||||
image: cloudlysis/control-api:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/control-api:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
CONTROL_API_ADDR: "0.0.0.0:8080"
|
||||
CONTROL_PLACEMENT_PATH: "/etc/control/placement.json"
|
||||
@@ -26,7 +26,7 @@ services:
|
||||
condition: on-failure
|
||||
|
||||
control-ui:
|
||||
image: cloudlysis/control-ui:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/control-ui:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
VITE_CONTROL_API_URL: "http://control-api:8080"
|
||||
networks:
|
||||
|
||||
@@ -13,7 +13,7 @@ services:
|
||||
replicas: 1
|
||||
|
||||
gateway:
|
||||
image: cloudlysis/gateway:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/gateway:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
GATEWAY_ADDR: 0.0.0.0:8080
|
||||
GATEWAY_GRPC_ADDR: 0.0.0.0:8081
|
||||
@@ -37,7 +37,7 @@ services:
|
||||
order: stop-first
|
||||
|
||||
aggregate:
|
||||
image: cloudlysis/aggregate:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/aggregate:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
AGGREGATE_NATS_URL: nats://nats:4222
|
||||
AGGREGATE_STORAGE_PATH: /data
|
||||
@@ -54,7 +54,7 @@ services:
|
||||
condition: on-failure
|
||||
|
||||
projection:
|
||||
image: cloudlysis/projection:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/projection:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
PROJECTION_NATS_URL: nats://nats:4222
|
||||
PROJECTION_STREAM_NAME: AGGREGATE_EVENTS
|
||||
@@ -81,7 +81,7 @@ services:
|
||||
failure_action: rollback
|
||||
|
||||
runner_saga:
|
||||
image: cloudlysis/runner:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/runner:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
RUNNER_NATS_URL: nats://nats:4222
|
||||
RUNNER_MODE: saga
|
||||
@@ -100,7 +100,7 @@ services:
|
||||
replicas: 1
|
||||
|
||||
runner_effect:
|
||||
image: cloudlysis/runner:dev
|
||||
image: ${IMAGE_PREFIX:-cloudlysis}/runner:${IMAGE_TAG:-dev}
|
||||
environment:
|
||||
RUNNER_NATS_URL: nats://nats:4222
|
||||
RUNNER_MODE: effect
|
||||
|
||||
Reference in New Issue
Block a user