Skip to content

Commit

Permalink
Merge pull request #7 from kepler16/jv/change-pxorrozussoy
Browse files Browse the repository at this point in the history
Add support for regex in hosts
  • Loading branch information
julienvincent authored Jul 16, 2024
2 parents c2d1555 + c94553e commit 26df3aa
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 110 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-latest-xlarge]
include:
- os: ubuntu-latest
binary-name: kl-linux-amd64
- os: macos-latest
binary-name: kl-macos-amd64
- os: macos-latest-xlarge
binary-name: kl-macos-arm64
- arch: linux-amd64
runs-on: ubuntu-latest
- arch: linux-arm64
runs-on: arm-c8
- arch: macos-amd64
runs-on: macos-latest
- arch: macos-arm64
runs-on: macos-latest-xlarge

env:
GITHUB_USERNAME: ${{ secrets.ORG_GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout git repo
uses: actions/checkout@v2
Expand All @@ -32,38 +33,34 @@ jobs:
- name: Fetch Tags
run: git fetch --tags origin

- uses: actions/setup-java@v2
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'temurin'
java-version: 21
java-version: '22'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: extractions/setup-just@v1
- uses: DeLaGuardo/setup-clojure@9.5
with:
cli: latest

- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure Auth
run: |
mkdir -p ~/.m2/
cp ./build/settings.xml ~/.m2/settings.xml
- name: Build Native Image
run: just build-native

- name: Pack binary
run: |
tar -czf ${{ matrix.binary-name }}.tar.gz -C ./target kl
tar -czf kl-${{ matrix.arch }}.tar.gz -C ./target kl
- uses: actions/upload-artifact@v3
with:
name: kl-native-images
name: binaries
if-no-files-found: error
path: ${{ matrix.binary-name }}.tar.gz
path: kl-${{ matrix.arch }}.tar.gz

release:
runs-on: ubuntu-latest
Expand All @@ -75,7 +72,7 @@ jobs:
- name: Download Binary Artifacts
uses: actions/download-artifact@v2
with:
name: kl-native-images
name: binaries
path: bin

- name: Calculate checksums
Expand All @@ -86,11 +83,6 @@ jobs:
mv checksums.txt bin/checksums.txt
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 21

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) [year] [fullname]
Copyright (c) Kepler16

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
145 changes: 100 additions & 45 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
(def basis (b/create-basis {:project "deps.edn"
:aliases [:native]}))
(def class-dir "target/classes")
(def uber-file "target/kl.jar")
(def jar-file "target/kl.jar")

(defn clean [_]
(b/delete {:path "target"}))

(defn uber [_]
(defn build [_]
(clean nil)
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
Expand All @@ -22,6 +22,6 @@
"-Dclojure.spec.skip-macros=true"]})

(b/uber {:class-dir class-dir
:uber-file uber-file
:uber-file jar-file
:basis basis
:main 'k16.kl.cli}))
14 changes: 7 additions & 7 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{:mvn/repos {"github-kepler" {:url "https://maven.pkg.github.com/kepler16/*"}}

:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
metosin/malli {:mvn/version "0.13.0"}
:deps {org.clojure/clojure {:mvn/version "1.11.3"}
metosin/malli {:mvn/version "0.16.2"}
meta-merge/meta-merge {:mvn/version "1.0.0"}
metosin/jsonista {:mvn/version "0.3.7"}
metosin/jsonista {:mvn/version "0.3.9"}
clj-commons/clj-yaml {:mvn/version "1.0.27"}
babashka/process {:mvn/version "0.5.21"}
jansi-clj/jansi-clj {:mvn/version "1.0.1"}
babashka/process {:mvn/version "0.5.22"}
jansi-clj/jansi-clj {:mvn/version "1.0.3"}
cli-matic/cli-matic {:mvn/version "0.5.4"}
org.clojars.civa86/pretty.cli {:mvn/version "1.0.1"}
funcool/promesa {:mvn/version "11.0.678"}
http-kit/http-kit {:mvn/version "2.7.0"}}
http-kit/http-kit {:mvn/version "2.8.0"}}

:aliases {:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.5"}}
:aliases {:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.5"}}
:ns-default build}

:native {:extra-deps {com.github.clj-easy/graal-build-time {:mvn/version "1.0.5"}}}
Expand Down
7 changes: 2 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
clean:
clojure -T:build clean

build: clean
clojure -T:build uber
build:
clojure -T:build build

native-image:
$GRAALVM_HOME/bin/native-image -jar target/kl.jar target/kl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Args = --no-fallback \
--features=clj_easy.graal_build_time.InitClojureClasses \
--report-unsupported-elements-at-runtime \
-H:+UnlockExperimentalVMOptions \
--initialize-at-build-time=org.fusesource.jansi.Ansi$Attribute,org.fusesource.jansi.Ansi$Color \
-H:ReflectionConfigurationResources=${.}/reflect-config.json \
-H:ResourceConfigurationResources=${.}/resource-config.json \
-H:+ReportExceptionStackTraces
4 changes: 3 additions & 1 deletion resources/k16/kl/module/network/module.edn
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@
:networks {:kl {:ipv4_address "172.5.0.100"}}}

:proxy ^:replace
{:image "traefik:v2.6"
{:image "traefik:v3.1"
:restart "unless-stopped"
:networks {:kl {:ipv4_address "172.5.0.101"}}
:command ["--api.insecure=true"
"--log.level=INFO"
"--accesslog=true"
"--providers.file.directory=/proxy-config"
"--providers.file.watch=true"]
:ports ["80:80"]
Expand Down
2 changes: 1 addition & 1 deletion src/k16/kl/api/proxy.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(api.fs/from-config-dir "proxy/" (str module-name ".yaml")))

(defn- route->traefik-rule [{:keys [host path-prefix]}]
(cond-> (str "Host(`" host "`)")
(cond-> (str "HostRegexp(`" host "`)")
path-prefix (str " && PathPrefix(`" path-prefix "`)")))

(defn- build-routes [module]
Expand Down
21 changes: 0 additions & 21 deletions src/k16/kl/prompt/editor.clj

This file was deleted.

0 comments on commit 26df3aa

Please sign in to comment.