Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
58 changes: 56 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
58 changes: 56 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "paerser"]
path = paerser
url = https://github.com/traefik/paerser
ignore = all
27 changes: 22 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 1.24.0+
- Git
- Docker

Expand All @@ -18,12 +18,21 @@ git clone https://github.com/steveiliop56/tinyauth
cd tinyauth
```

## Initialize submodules

The project uses Git submodules for some dependencies, so you need to initialize them with:

```sh
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:
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 tidy
go mod download
```

You also need to download the frontend dependencies, this can be done like so:
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ ARG BUILD_TIMESTAMP

WORKDIR /tinyauth

COPY ./paerser ./paerser

COPY go.mod ./
COPY go.sum ./

Expand All @@ -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

Expand All @@ -62,4 +64,4 @@ ENV PATH=$PATH:/tinyauth

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"]

ENTRYPOINT ["tinyauth"]
ENTRYPOINT ["tinyauth"]
4 changes: 3 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM golang:1.25-alpine3.21

WORKDIR /tinyauth

COPY ./paerser ./paerser

COPY go.mod ./
COPY go.sum ./

Expand All @@ -20,4 +22,4 @@ ENV TINYAUTH_DATABASEPATH=/data/tinyauth.db

ENV TINYAUTH_RESOURCESDIR=/data/resources

ENTRYPOINT ["air", "-c", "air.toml"]
ENTRYPOINT ["air", "-c", "air.toml"]
6 changes: 4 additions & 2 deletions Dockerfile.distroless
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ ARG BUILD_TIMESTAMP

WORKDIR /tinyauth

COPY ./paerser ./paerser

COPY go.mod ./
COPY go.sum ./

Expand All @@ -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

Expand All @@ -65,4 +67,4 @@ ENV PATH=$PATH:/tinyauth

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD ["tinyauth", "healthcheck"]

ENTRYPOINT ["tinyauth"]
ENTRYPOINT ["tinyauth"]
1 change: 0 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.24.0

toolchain go1.24.3

replace github.com/traefik/paerser v0.2.2 => ./paerser

require (
github.com/cenkalti/backoff/v5 v5.0.3
github.com/charmbracelet/huh v0.8.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/traefik/paerser v0.2.2 h1:cpzW/ZrQrBh3mdwD/jnp6aXASiUFKOVr6ldP+keJTcQ=
github.com/traefik/paerser v0.2.2/go.mod h1:7BBDd4FANoVgaTZG+yh26jI6CA2nds7D/4VTEdIsh24=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
Expand Down
2 changes: 1 addition & 1 deletion internal/bootstrap/service_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (app *BootstrapApp) initServices() (Services, error) {

services.dockerService = dockerService

accessControlsService := service.NewAccessControlsService(dockerService)
accessControlsService := service.NewAccessControlsService(dockerService, app.config.Apps)

err = accessControlsService.Init()

Expand Down
Loading