Compare commits
No commits in common. "master" and "codex" have entirely different histories.
6 changed files with 9 additions and 128 deletions
|
|
@ -1,18 +1,9 @@
|
||||||
when:
|
when:
|
||||||
- event: push
|
- event: push
|
||||||
|
- branch: master
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: smoke
|
deploy:
|
||||||
image: bash
|
commands:
|
||||||
commands:
|
- sh ~/nixconf/update.sh
|
||||||
- pwd
|
- nh os switch -H sortug ~/nixconf --target-host root@sortug
|
||||||
- whoami
|
|
||||||
- hostname
|
|
||||||
- printf '%s %s %s\n' "$(date --iso-8601=seconds)" "$(hostname)" "$(git rev-parse --short HEAD)" >> /var/tmp/woodpecker-smoke.log
|
|
||||||
- tail -n 5 /var/tmp/woodpecker-smoke.log
|
|
||||||
|
|
||||||
- name: deploy
|
|
||||||
image: bash
|
|
||||||
commands:
|
|
||||||
- '[ "${CI_COMMIT_BRANCH:-}" = "master" ] || { echo "skipping deploy on branch ${CI_COMMIT_BRANCH:-unknown}"; exit 0; }'
|
|
||||||
- bash ./scripts/deploy-app.sh
|
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
steps:
|
|
||||||
checks:
|
|
||||||
image: nixos/nix:latest
|
|
||||||
commands:
|
|
||||||
- nix develop --accept-flake-config -c bun install --frozen-lockfile
|
|
||||||
- nix develop --accept-flake-config -c bun run lint
|
|
||||||
- nix develop --accept-flake-config -c bun run typecheck
|
|
||||||
- nix develop --accept-flake-config -c bun run build
|
|
||||||
- nix develop --accept-flake-config -c bun run update:bun-nix
|
|
||||||
- git diff --exit-code bun.nix
|
|
||||||
- nix build --accept-flake-config .#default
|
|
||||||
|
|
||||||
when:
|
|
||||||
- event: [pull_request, push]
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
steps:
|
|
||||||
deploy:
|
|
||||||
image: nixos/nix:latest
|
|
||||||
commands:
|
|
||||||
- sudo -n /usr/local/libexec/deploy-sortug
|
|
||||||
|
|
||||||
when:
|
|
||||||
- event: push
|
|
||||||
- branch: master
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
steps:
|
|
||||||
checks:
|
|
||||||
image: nixos/nix:latest
|
|
||||||
commands:
|
|
||||||
- nix develop --accept-flake-config -c bun install --frozen-lockfile
|
|
||||||
- nix develop --accept-flake-config -c bun run lint
|
|
||||||
- nix develop --accept-flake-config -c bun run typecheck
|
|
||||||
- nix develop --accept-flake-config -c bun run build
|
|
||||||
- nix develop --accept-flake-config -c bun run update:bun-nix
|
|
||||||
- git diff --exit-code bun.nix
|
|
||||||
- nix build --accept-flake-config .#default
|
|
||||||
|
|
||||||
when:
|
|
||||||
- event: [pull_request, push]
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
steps:
|
|
||||||
deploy:
|
|
||||||
image: nixos/nix:latest
|
|
||||||
commands:
|
|
||||||
- sudo -n /usr/local/libexec/deploy-sortug
|
|
||||||
|
|
||||||
when:
|
|
||||||
- event: push
|
|
||||||
- branch: master
|
|
||||||
11
lol.lmao
11
lol.lmao
|
|
@ -1,11 +0,0 @@
|
||||||
1
|
|
||||||
2
|
|
||||||
3
|
|
||||||
4
|
|
||||||
5
|
|
||||||
6
|
|
||||||
7
|
|
||||||
8
|
|
||||||
9
|
|
||||||
10
|
|
||||||
11
|
|
||||||
|
|
@ -2,14 +2,6 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.kotsukotsu;
|
cfg = config.services.kotsukotsu;
|
||||||
launcher = pkgs.writeShellScript "kotsukotsu-launch" ''
|
|
||||||
exec ${cfg.currentPath}/bin/kotsukotsu
|
|
||||||
'';
|
|
||||||
ensureCurrent = pkgs.writeShellScript "kotsukotsu-ensure-current" ''
|
|
||||||
if [ ! -e ${cfg.currentPath} ]; then
|
|
||||||
ln -sfn ${cfg.package} ${cfg.currentPath}
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.kotsukotsu = {
|
options.services.kotsukotsu = {
|
||||||
|
|
@ -46,12 +38,6 @@ in
|
||||||
description = "Directory for the persistent SQLite database.";
|
description = "Directory for the persistent SQLite database.";
|
||||||
};
|
};
|
||||||
|
|
||||||
currentPath = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "/var/lib/kotsukotsu/current";
|
|
||||||
description = "Stable symlink path that points at the active app package.";
|
|
||||||
};
|
|
||||||
|
|
||||||
user = lib.mkOption {
|
user = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "kotsukotsu";
|
default = "kotsukotsu";
|
||||||
|
|
@ -85,10 +71,6 @@ in
|
||||||
assertion = lib.hasPrefix "/" cfg.dataDir;
|
assertion = lib.hasPrefix "/" cfg.dataDir;
|
||||||
message = "services.kotsukotsu.dataDir must be an absolute path.";
|
message = "services.kotsukotsu.dataDir must be an absolute path.";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
assertion = lib.hasPrefix "/" cfg.currentPath;
|
|
||||||
message = "services.kotsukotsu.currentPath must be an absolute path.";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
users.groups = lib.mkIf (cfg.group == "kotsukotsu") {
|
users.groups = lib.mkIf (cfg.group == "kotsukotsu") {
|
||||||
|
|
@ -122,8 +104,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = launcher;
|
ExecStart = lib.getExe cfg.package;
|
||||||
ExecStartPre = ensureCurrent;
|
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
target_host="${1:-root@sortug.com}"
|
|
||||||
service_name="${SERVICE_NAME:-kotsukotsu}"
|
|
||||||
current_path="${CURRENT_PATH:-/var/lib/kotsukotsu/current}"
|
|
||||||
health_url="${HEALTH_URL:-http://127.0.0.1:5174/healthz}"
|
|
||||||
|
|
||||||
store_path="$(nix build --accept-flake-config --print-out-paths .#default | tail -n 1)"
|
|
||||||
|
|
||||||
echo "Built ${store_path}"
|
|
||||||
echo "Copying package to ${target_host}"
|
|
||||||
nix copy --to "ssh://${target_host}" "${store_path}"
|
|
||||||
|
|
||||||
echo "Activating release on ${target_host}"
|
|
||||||
ssh "${target_host}" "
|
|
||||||
set -euo pipefail
|
|
||||||
ln -sfn '${store_path}' '${current_path}'
|
|
||||||
systemctl restart '${service_name}'
|
|
||||||
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
|
||||||
if curl -fsS '${health_url}' >/dev/null; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
echo 'health check failed for ${service_name}' >&2
|
|
||||||
exit 1
|
|
||||||
"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue