From 016edc6999f9d45184136e50b5b19d34529d087d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 2 Jun 2024 00:19:27 +0200 Subject: deploy locally with just to vercel --- flake.nix | 1 + justfile | 33 +++++++++++++++++++-------------- netlify.toml | 29 ----------------------------- netlify/netlify.toml | 14 -------------- 4 files changed, 20 insertions(+), 57 deletions(-) delete mode 100644 netlify.toml delete mode 100644 netlify/netlify.toml diff --git a/flake.nix b/flake.nix index 949ccf4..8b4057f 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,7 @@ go-tools gomod2nix.packages.${system}.default gci + hyperlink nodePackages.vercel netlify-cli sentry-cli diff --git a/justfile b/justfile index 2fd26ab..bf20fbf 100755 --- a/justfile +++ b/justfile @@ -3,19 +3,24 @@ fly-system := "x86_64-linux" fly-registry := "registry.fly.io/alanpearce-eu" docker-tag := env_var_or_default("DOCKER_TAG", `date +%Y%m%d%H%M%S` + "-" + `git rev-parse --short HEAD`) -version := `sentry-cli releases propose-version` environment := "production" started-at := `date +%s` default: @just --list --justfile {{ justfile() }} --unsorted +clean: + rm -r website + check: nix flake check . --print-build-logs check-licenses: nix run nixpkgs#go-licenses check ./... +check-links: + hyperlink website/public + update-all: go get -u all gomod2nix --outdir nix @@ -26,8 +31,8 @@ watch-flake command: watch-builder: (watch-flake "watchexec -w cmd/build -w content -w templates -r go run ./cmd/build --base-url http://localhost:3000") -generate: - go run ./cmd/build --base-url http://localhost:3000 +build: + go run ./cmd/build nix-build what: nix build .#{{ what }} @@ -62,21 +67,21 @@ docker-inspect image-path="result": print-docker-tag: @echo {{ fly-registry }}:{{ docker-tag }} -stream-to-registry : sentry-create-release && sentry-finalise-release +stream-to-registry : just docker-stream-fly | gzip --fast | skopeo copy --dest-precompute-digests docker-archive:/dev/stdin docker://{{ fly-registry }}:{{ docker-tag }} -push-to-registry: sentry-create-release && sentry-finalise-release +push-to-registry: skopeo copy --dest-precompute-digests docker-archive://`readlink -f result` docker://{{ fly-registry }}:{{ docker-tag }} -sentry-create-release: - sentry-cli releases new {{ version }} +deploy-fly registry-and-tag=(fly-registry + ":" + docker-tag): + fly deploy --image {{ registry-and-tag }} -sentry-finalise-release: - sentry-cli releases set-commits {{ version }} --ignore-missing --auto # will not work in CI - sentry-cli releases finalize {{ version }} +deploy-vercel-preview: clean build + vercel pull --environment=preview + vercel deploy -sentry-create-deploy: - sentry-cli releases deploys {{ version }} new --started {{ started-at }} --finished `date +%s` --env {{ environment }} +deploy-vercel: clean build check-links + vercel pull --environment=production + vercel deploy --prod -deploy registry-and-tag=(fly-registry + ":" + docker-tag): && sentry-create-deploy - fly deploy --image {{ registry-and-tag }} +deploy-production: deploy-vercel diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index d733f41..0000000 --- a/netlify.toml +++ /dev/null @@ -1,29 +0,0 @@ -[build] - publish = "website/public" - -[[headers]] - for = "/*" - [headers.values] - x-content-type-options = "nosniff" - x-xss-protection = "1; mode=block" - referrer-policy = "strict-origin-when-cross-origin" - strict-transport-security = "max-age=63072000; includeSubDomains; preload" - cache-control = ''' - max-age=300, - s-maxage=86400, - state-while-revalidate - ''' - content-security-policy = ''' - default-src 'none'; - img-src 'self' https://gc.zgo.at; - object-src 'none'; - script-src 'self' https://gc.zgo.at; - style-src - 'sha256-a4TPKWHB0aSu7cV10GthTEySTJ0w4r0bw6Q8JsNYMbk=' - 'sha256-gyxzfgCOxeAAL8URUdaW2nHYDOr9bzbwFjgSqi7D+8U='; - form-action 'none'; - base-uri 'self'; - connect-src https://alanpearce-eu.goatcounter.com/count; - frame-ancestors 'https://kagi.com'; - require-trusted-types-for "'script'" -''' diff --git a/netlify/netlify.toml b/netlify/netlify.toml deleted file mode 100644 index 7b203eb..0000000 --- a/netlify/netlify.toml +++ /dev/null @@ -1,14 +0,0 @@ -[build] - base = "netlify" - publish = "." - -[[redirects]] - from = "*" - to = "https://alanpearce.eu/:splat" - status = 301 - force = true - -[[headers]] - for = "/*" - [headers.values] - cache-control = "max-age=86400" -- cgit 1.4.1