Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a912c50b88 | ||
|
|
9137cf2d92 | ||
|
|
d14629e6a6 | ||
|
|
124a207968
|
||
|
|
bec233ede8
|
||
|
|
69ca30ae6b
|
||
|
|
7663ef111f | ||
|
|
56111291c7
|
||
|
|
63ff1049dd | ||
|
|
eabb304f3c | ||
|
|
dd646b0a99 | ||
|
|
d49c7cfdab |
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:
|
concurrency:
|
||||||
group: ci-${{ gitea.ref }}
|
group: ci-${{ gitea.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -19,6 +19,8 @@ jobs:
|
|||||||
name: Test and publish
|
name: Test and publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
outputs:
|
||||||
|
image: ${{ steps.publish.outputs.image }}
|
||||||
env:
|
env:
|
||||||
IMAGE: code.popov.link/valentineus/vacationplanner2ics
|
IMAGE: code.popov.link/valentineus/vacationplanner2ics
|
||||||
TEST_IMAGE: vacationplanner2ics-test:ci-${{ gitea.run_id }}
|
TEST_IMAGE: vacationplanner2ics-test:ci-${{ gitea.run_id }}
|
||||||
@@ -75,6 +77,7 @@ jobs:
|
|||||||
test "$(docker inspect --format '{{.State.ExitCode}}' "$SMOKE_CONTAINER")" = 0
|
test "$(docker inspect --format '{{.State.ExitCode}}' "$SMOKE_CONTAINER")" = 0
|
||||||
|
|
||||||
- name: Publish to Gitea Container Registry
|
- name: Publish to Gitea Container Registry
|
||||||
|
id: publish
|
||||||
if: >-
|
if: >-
|
||||||
gitea.event_name != 'pull_request' &&
|
gitea.event_name != 'pull_request' &&
|
||||||
(gitea.ref == 'refs/heads/master' || startsWith(gitea.ref, 'refs/tags/v'))
|
(gitea.ref == 'refs/heads/master' || startsWith(gitea.ref, 'refs/tags/v'))
|
||||||
@@ -97,9 +100,62 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
docker tag "$RUNTIME_IMAGE" "$IMAGE:$TAG"
|
docker tag "$RUNTIME_IMAGE" "$IMAGE:$TAG"
|
||||||
docker push "$IMAGE:$TAG"
|
docker push "$IMAGE:$TAG"
|
||||||
|
printf 'image=%s:%s\n' "$IMAGE" "$TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Remove temporary containers and image tags
|
- name: Remove temporary containers and image tags
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
docker rm -f "$SMOKE_CONTAINER" 2>/dev/null || true
|
docker rm -f "$SMOKE_CONTAINER" 2>/dev/null || true
|
||||||
docker image rm "$TEST_IMAGE" "$RUNTIME_IMAGE" 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
+10
-10
@@ -242,7 +242,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -456,9 +456,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icalendar"
|
name = "icalendar"
|
||||||
version = "0.17.13"
|
version = "0.17.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fda1b791865374063fa57e84adfe3823c2d5cd5968d721533be4556a24cffd8"
|
checksum = "ef7e7ae829dee4463f049b1f2855a7b0ba7a255bef3c06a09ca22a7befa4e9e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"iso8601",
|
"iso8601",
|
||||||
@@ -833,7 +833,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -995,7 +995,7 @@ dependencies = [
|
|||||||
"security-framework",
|
"security-framework",
|
||||||
"security-framework-sys",
|
"security-framework-sys",
|
||||||
"webpki-root-certs",
|
"webpki-root-certs",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1107,9 +1107,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.151"
|
version = "1.0.154"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
|
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"memchr",
|
"memchr",
|
||||||
@@ -1296,9 +1296,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.53.1"
|
version = "1.54.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
|
checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -1570,7 +1570,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM rust:1.98.1-alpine3.22 AS build
|
FROM rust:1.99.1-alpine3.22 AS build
|
||||||
RUN apk add --no-cache cmake make
|
RUN apk add --no-cache cmake make
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|||||||
+7
-6
@@ -1,13 +1,14 @@
|
|||||||
|
name: vacationplanner2ics
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build:
|
image: ${IMAGE:-code.popov.link/valentineus/vacationplanner2ics:latest}
|
||||||
context: .
|
pull_policy: always
|
||||||
target: runtime
|
network_mode: host
|
||||||
environment:
|
environment:
|
||||||
|
BIND_ADDR: 127.0.0.1:${HTTP_PORT:-8080}
|
||||||
API_URL: ${API_URL:-https://api.vacationplanner.ru}
|
API_URL: ${API_URL:-https://api.vacationplanner.ru}
|
||||||
UPSTREAM_TIMEOUT_SECONDS: ${UPSTREAM_TIMEOUT_SECONDS:-15}
|
UPSTREAM_TIMEOUT_SECONDS: ${UPSTREAM_TIMEOUT_SECONDS:-15}
|
||||||
ports:
|
|
||||||
- "127.0.0.1:8080:8080"
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
read_only: true
|
read_only: true
|
||||||
cap_drop: [ALL]
|
cap_drop: [ALL]
|
||||||
@@ -16,7 +17,7 @@ services:
|
|||||||
|
|
||||||
dev:
|
dev:
|
||||||
profiles: [dev]
|
profiles: [dev]
|
||||||
image: rust:1.98.1-bookworm
|
image: rust:1.99.1-bookworm
|
||||||
working_dir: /workspace
|
working_dir: /workspace
|
||||||
command: sleep infinity
|
command: sleep infinity
|
||||||
init: true
|
init: true
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.98.1"
|
channel = "1.99.1"
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
components = ["clippy", "rustfmt"]
|
components = ["clippy", "rustfmt"]
|
||||||
Reference in new issue
Block a user