Compare commits
7
Commits
63ff1049dd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9137cf2d92 | ||
|
|
d14629e6a6 | ||
|
|
124a207968
|
||
|
|
bec233ede8
|
||
|
|
69ca30ae6b
|
||
|
|
7663ef111f | ||
|
|
56111291c7
|
No files matched your search
@@ -0,0 +1,3 @@
|
||||
API_URL=https://api.vacationplanner.ru
|
||||
UPSTREAM_TIMEOUT_SECONDS=15
|
||||
HTTP_PORT=8080
|
||||
+57
-1
@@ -9,7 +9,7 @@ on:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
cancel-in-progress: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -19,6 +19,8 @@ jobs:
|
||||
name: Test and publish
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
outputs:
|
||||
image: ${{ steps.publish.outputs.image }}
|
||||
env:
|
||||
IMAGE: code.popov.link/valentineus/vacationplanner2ics
|
||||
TEST_IMAGE: vacationplanner2ics-test:ci-${{ gitea.run_id }}
|
||||
@@ -75,6 +77,7 @@ jobs:
|
||||
test "$(docker inspect --format '{{.State.ExitCode}}' "$SMOKE_CONTAINER")" = 0
|
||||
|
||||
- name: Publish to Gitea Container Registry
|
||||
id: publish
|
||||
if: >-
|
||||
gitea.event_name != 'pull_request' &&
|
||||
(gitea.ref == 'refs/heads/master' || startsWith(gitea.ref, 'refs/tags/v'))
|
||||
@@ -97,9 +100,62 @@ jobs:
|
||||
fi
|
||||
docker tag "$RUNTIME_IMAGE" "$IMAGE:$TAG"
|
||||
docker push "$IMAGE:$TAG"
|
||||
printf 'image=%s:%s\n' "$IMAGE" "$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Remove temporary containers and image tags
|
||||
if: always()
|
||||
run: |
|
||||
docker rm -f "$SMOKE_CONTAINER" 2>/dev/null || true
|
||||
docker image rm "$TEST_IMAGE" "$RUNTIME_IMAGE" 2>/dev/null || true
|
||||
|
||||
deploy-server:
|
||||
name: Deploy published image to production
|
||||
needs: ci
|
||||
if: >-
|
||||
gitea.ref == 'refs/heads/master' &&
|
||||
(gitea.event_name == 'push' || gitea.event_name == 'workflow_dispatch')
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
IMAGE: ${{ needs.ci.outputs.image }}
|
||||
DEPLOY_SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }}
|
||||
DEPLOY_SSH_PORT: ${{ secrets.DEPLOY_SSH_PORT }}
|
||||
DEPLOY_SSH_USER: ${{ secrets.DEPLOY_SSH_USER }}
|
||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||
DEPLOY_SSH_PRIVATE_KEY_BASE64: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY_BASE64 }}
|
||||
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }}
|
||||
steps:
|
||||
- name: Checkout deployment files
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Deploy and check readiness
|
||||
shell: bash
|
||||
run: |
|
||||
set -Eeuo pipefail
|
||||
umask 077
|
||||
ssh_directory="$(mktemp -d)"
|
||||
trap 'rm -rf "$ssh_directory"' EXIT
|
||||
printf '%s' "$DEPLOY_SSH_PRIVATE_KEY_BASE64" | base64 --decode > "$ssh_directory/key"
|
||||
printf '%s\n' "$DEPLOY_SSH_KNOWN_HOSTS" > "$ssh_directory/known_hosts"
|
||||
|
||||
ssh -i "$ssh_directory/key" -p "$DEPLOY_SSH_PORT" \
|
||||
-o UserKnownHostsFile="$ssh_directory/known_hosts" \
|
||||
-o StrictHostKeyChecking=yes -o BatchMode=yes -o IdentitiesOnly=yes \
|
||||
-o ConnectTimeout=15 -o ConnectionAttempts=3 \
|
||||
-o ServerAliveInterval=15 -o ServerAliveCountMax=3 \
|
||||
"$DEPLOY_SSH_USER@$DEPLOY_SSH_HOST" "
|
||||
set -eu
|
||||
cd '$DEPLOY_PATH'
|
||||
cat > compose.yaml
|
||||
export IMAGE='$IMAGE'
|
||||
docker compose pull app
|
||||
sed -i '/^IMAGE=/d' .env
|
||||
printf '\\nIMAGE=%s\\n' '$IMAGE' >> .env
|
||||
docker compose up --pull never --detach --force-recreate app
|
||||
|
||||
bind_addr=\$(docker inspect --format '{{range .Config.Env}}{{println .}}{{end}}' \"\$(docker compose ps --quiet app)\" | sed -n 's/^BIND_ADDR=//p')
|
||||
curl --fail --silent --show-error --retry 15 --retry-all-errors \
|
||||
--retry-delay 2 --max-time 3 \"http://\$bind_addr/healthz\" | grep -qx ok
|
||||
" < compose.yaml
|
||||
Generated
+2
-2
@@ -456,9 +456,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icalendar"
|
||||
version = "0.17.14"
|
||||
version = "0.17.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "785af055d3fda0cd975e77b358d8e5d20dd7dbcca6a61eefd197410b8a1cbfe7"
|
||||
checksum = "ef7e7ae829dee4463f049b1f2855a7b0ba7a255bef3c06a09ca22a7befa4e9e4"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"iso8601",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM rust:1.99.0-alpine3.22 AS build
|
||||
FROM rust:1.99.1-alpine3.22 AS build
|
||||
RUN apk add --no-cache cmake make
|
||||
WORKDIR /build
|
||||
ARG TARGETARCH
|
||||
|
||||
+7
-6
@@ -1,13 +1,14 @@
|
||||
name: vacationplanner2ics
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
target: runtime
|
||||
image: ${IMAGE:-code.popov.link/valentineus/vacationplanner2ics:latest}
|
||||
pull_policy: always
|
||||
network_mode: host
|
||||
environment:
|
||||
BIND_ADDR: 127.0.0.1:${HTTP_PORT:-8080}
|
||||
API_URL: ${API_URL:-https://api.vacationplanner.ru}
|
||||
UPSTREAM_TIMEOUT_SECONDS: ${UPSTREAM_TIMEOUT_SECONDS:-15}
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
cap_drop: [ALL]
|
||||
@@ -16,7 +17,7 @@ services:
|
||||
|
||||
dev:
|
||||
profiles: [dev]
|
||||
image: rust:1.99.0-bookworm
|
||||
image: rust:1.99.1-bookworm
|
||||
working_dir: /workspace
|
||||
command: sleep infinity
|
||||
init: true
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "1.99.0"
|
||||
channel = "1.99.1"
|
||||
profile = "minimal"
|
||||
components = ["clippy", "rustfmt"]
|
||||
Reference in new issue
Block a user