diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c67bed..6e70165 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,16 @@ jobs: - name: Setup go uses: actions/setup-go@v5 with: - go-version: "^1.23.2" + go-version: "^1.24.0" + + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5bc3e09..05563b6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -61,7 +61,16 @@ jobs: - name: Install go uses: actions/setup-go@v5 with: - go-version: "^1.23.2" + go-version: "^1.24.0" + + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | @@ -107,7 +116,16 @@ jobs: - name: Install go uses: actions/setup-go@v5 with: - go-version: "^1.23.2" + go-version: "^1.24.0" + + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | @@ -147,6 +165,15 @@ jobs: with: ref: nightly + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -205,6 +232,15 @@ jobs: with: ref: nightly + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -263,6 +299,15 @@ jobs: with: ref: nightly + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -321,6 +366,15 @@ jobs: with: ref: nightly + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6896c2..1edf09d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,16 @@ jobs: - name: Install go uses: actions/setup-go@v5 with: - go-version: "^1.23.2" + go-version: "^1.24.0" + + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | @@ -82,7 +91,16 @@ jobs: - name: Install go uses: actions/setup-go@v5 with: - go-version: "^1.23.2" + go-version: "^1.24.0" + + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff - name: Install frontend dependencies run: | @@ -119,6 +137,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -174,6 +201,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -229,6 +265,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -284,6 +329,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Initialize submodules + run: | + git submodule init + git submodule update + + - name: Apply patches + run: | + git apply --directory paerser/ patches/nested_maps.diff + - name: Docker meta id: meta uses: docker/metadata-action@v5 diff --git a/.gitmodules b/.gitmodules index f4441b7..c3cedbc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "paerser"] path = paerser url = https://github.com/traefik/paerser + ignore = all diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 079d181..5a32607 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Contributing is relatively easy, you just need to follow the steps below and you ## Requirements - Bun -- Golang v1.23.2 and above +- Golang v1.24.0+ - Git - Docker @@ -18,12 +18,21 @@ git clone https://github.com/steveiliop56/tinyauth cd tinyauth ``` -## Install requirements +## Initialize submodules -Although you will not need the requirements in your machine since the development will happen in docker, I still recommend to install them because this way you will not have import errors. To install the go requirements run: +The project uses Git submodules for some dependencies, so you need to initialize them with: ```sh -go mod tidy +git submodule init +git submodule update +``` + +## Install requirements + +Although you will not need the requirements in your machine since the development will happen in Docker, I still recommend to install them because this way you will not have import errors. To install the Go requirements run: + +```sh +go mod download ``` You also need to download the frontend dependencies, this can be done like so: @@ -33,13 +42,21 @@ cd frontend/ bun install ``` +## Apply patches + +Some of the dependencies need to be patched in order to work correctly with the project, you can apply the patches by running: + +```sh +git apply --directory paerser/ patches/nested_maps.diff +``` + ## Create your `.env` file In order to configure the app you need to create an environment file, this can be done by copying the `.env.example` file to `.env` and modifying the environment variables to suit your needs. ## Developing -I have designed the development workflow to be entirely in docker, this is because it will directly work with traefik and you will not need to do any building in your host machine. The recommended development setup is to have a subdomain pointing to your machine like this: +I have designed the development workflow to be entirely in Docker, this is because it will directly work with Traefik and you will not need to do any building in your host machine. The recommended development setup is to have a subdomain pointing to your machine like this: ``` *.dev.example.com -> 127.0.0.1 @@ -49,7 +66,7 @@ dev.example.com -> 127.0.0.1 > [!TIP] > You can use [sslip.io](https://sslip.io) as a domain if you don't have one to develop with. -Then you can just make sure the domains are correct in the development docker compose file and run: +Then you can just make sure the domains are correct in the development Docker compose file and run: ```sh docker compose -f docker-compose.dev.yml up --build diff --git a/Dockerfile b/Dockerfile index 41500ed..aae8e0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,8 @@ ARG BUILD_TIMESTAMP WORKDIR /tinyauth +COPY ./paerser ./paerser + COPY go.mod ./ COPY go.sum ./ @@ -38,7 +40,7 @@ COPY ./internal ./internal COPY --from=frontend-builder /frontend/dist ./internal/assets/dist RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth - + # Runner FROM alpine:3.23 AS runner @@ -62,4 +64,4 @@ ENV PATH=$PATH:/tinyauth HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"] -ENTRYPOINT ["tinyauth"] \ No newline at end of file +ENTRYPOINT ["tinyauth"] diff --git a/Dockerfile.distroless b/Dockerfile.distroless index 9806bea..52fb344 100644 --- a/Dockerfile.distroless +++ b/Dockerfile.distroless @@ -28,6 +28,8 @@ ARG BUILD_TIMESTAMP WORKDIR /tinyauth +COPY ./paerser ./paerser + COPY go.mod ./ COPY go.sum ./ @@ -40,7 +42,7 @@ COPY --from=frontend-builder /frontend/dist ./internal/assets/dist RUN mkdir -p data RUN CGO_ENABLED=0 go build -ldflags "-s -w -X tinyauth/internal/config.Version=${VERSION} -X tinyauth/internal/config.CommitHash=${COMMIT_HASH} -X tinyauth/internal/config.BuildTimestamp=${BUILD_TIMESTAMP}" ./cmd/tinyauth - + # Runner FROM gcr.io/distroless/static-debian12:latest AS runner @@ -65,4 +67,4 @@ ENV PATH=$PATH:/tinyauth HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"] -ENTRYPOINT ["tinyauth"] \ No newline at end of file +ENTRYPOINT ["tinyauth"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index cc454f6..8ffd6fd 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -42,7 +42,6 @@ services: volumes: - ./internal:/tinyauth/internal - ./cmd:/tinyauth/cmd - - ./main.go:/tinyauth/main.go - /var/run/docker.sock:/var/run/docker.sock - ./data:/data ports: diff --git a/paerser b/paerser index 9364ccd..7e1b633 160000 --- a/paerser +++ b/paerser @@ -1 +1 @@ -Subproject commit 9364ccd8baa484ac402cdd7ba4c40c67f957aa33 +Subproject commit 7e1b633ba9fd73f136891ddfec372b2e94d9e9c8