-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4f5b355
Showing
28 changed files
with
1,309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
root = "." | ||
testdata_dir = "testdata" | ||
tmp_dir = ".build" | ||
|
||
[build] | ||
args_bin = [] | ||
bin = "./.build/main" | ||
cmd = "templ generate && go build -o ./.build/main ./cmd" | ||
delay = 1000 | ||
exclude_dir = ["assets", ".build", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go", "_templ.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html", "templ"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
post_cmd = [] | ||
pre_cmd = [] | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
main_only = false | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false | ||
|
||
[screen] | ||
clear_on_rebuild = false | ||
keep_scroll = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
target | ||
DockerFile | ||
.vscode | ||
.gitignore | ||
database |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ghcr.io/maantje/postcode:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
bin | ||
.build | ||
.env | ||
*_templ.go | ||
database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
# A sample post-deploy hook | ||
# | ||
# These environment variables are available: | ||
# KAMAL_RECORDED_AT | ||
# KAMAL_PERFORMER | ||
# KAMAL_VERSION | ||
# KAMAL_HOSTS | ||
# KAMAL_ROLE (if set) | ||
# KAMAL_DESTINATION (if set) | ||
# KAMAL_RUNTIME | ||
|
||
echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
echo "Rebooted Traefik on $KAMAL_HOSTS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/sh | ||
|
||
# A sample pre-build hook | ||
# | ||
# Checks: | ||
# 1. We have a clean checkout | ||
# 2. A remote is configured | ||
# 3. The branch has been pushed to the remote | ||
# 4. The version we are deploying matches the remote | ||
# | ||
# These environment variables are available: | ||
# KAMAL_RECORDED_AT | ||
# KAMAL_PERFORMER | ||
# KAMAL_VERSION | ||
# KAMAL_HOSTS | ||
# KAMAL_ROLE (if set) | ||
# KAMAL_DESTINATION (if set) | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Git checkout is not clean, aborting..." >&2 | ||
git status --porcelain >&2 | ||
exit 1 | ||
fi | ||
|
||
first_remote=$(git remote) | ||
|
||
if [ -z "$first_remote" ]; then | ||
echo "No git remote set, aborting..." >&2 | ||
exit 1 | ||
fi | ||
|
||
current_branch=$(git branch --show-current) | ||
|
||
if [ -z "$current_branch" ]; then | ||
echo "Not on a git branch, aborting..." >&2 | ||
exit 1 | ||
fi | ||
|
||
remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1) | ||
|
||
if [ -z "$remote_head" ]; then | ||
echo "Branch not pushed to remote, aborting..." >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ "$KAMAL_VERSION" != "$remote_head" ]; then | ||
echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2 | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# A sample pre-connect check | ||
# | ||
# Warms DNS before connecting to hosts in parallel | ||
# | ||
# These environment variables are available: | ||
# KAMAL_RECORDED_AT | ||
# KAMAL_PERFORMER | ||
# KAMAL_VERSION | ||
# KAMAL_HOSTS | ||
# KAMAL_ROLE (if set) | ||
# KAMAL_DESTINATION (if set) | ||
# KAMAL_RUNTIME | ||
|
||
hosts = ENV["KAMAL_HOSTS"].split(",") | ||
results = nil | ||
max = 3 | ||
|
||
elapsed = Benchmark.realtime do | ||
results = hosts.map do |host| | ||
Thread.new do | ||
tries = 1 | ||
|
||
begin | ||
Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) | ||
rescue SocketError | ||
if tries < max | ||
puts "Retrying DNS warmup: #{host}" | ||
tries += 1 | ||
sleep rand | ||
retry | ||
else | ||
puts "DNS warmup failed: #{host}" | ||
host | ||
end | ||
end | ||
|
||
tries | ||
end | ||
end.map(&:value) | ||
end | ||
|
||
retries = results.sum - hosts.size | ||
nopes = results.count { |r| r == max } | ||
|
||
puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ] |
Oops, something went wrong.