-
-
Save joekrill/cc503e21e14f95fefa91acc5f869dac1 to your computer and use it in GitHub Desktop.
| version: "3.9" | |
| volumes: | |
| postgres: | |
| services: | |
| postgres: | |
| image: postgres | |
| restart: unless-stopped | |
| healthcheck: | |
| test: ["CMD-SHELL", "pg_isready -d linkwarden -U linkwarden || exit 1"] | |
| interval: 5s | |
| timeout: 5s | |
| start_period: 30s | |
| retries: 10 | |
| environment: | |
| POSTGRES_HOST_AUTH_METHOD: "trust" | |
| POSTGRES_USER: linkwarden | |
| POSTGRES_PASSWORD: Linkwarden123! | |
| POSTGRES_DB: linkwarden | |
| volumes: | |
| - postgres:/var/lib/postgresql | |
| linkwarden-migrate: &linkwarden-service | |
| image: "linkwarden/linkwarden" | |
| restart: on-failure | |
| build: | |
| context: https://github.com/linkwarden/linkwarden.git#main | |
| dockerfile_inline: | | |
| FROM node:20 | |
| WORKDIR /opt/linkwarden | |
| COPY . . | |
| RUN yarn && \ | |
| npx [email protected] install-deps && \ | |
| yarn build | |
| ENTRYPOINT ["yarn"] | |
| CMD ["start"] | |
| command: prisma migrate deploy | |
| environment: | |
| - DATABASE_URL=postgres://linkwarden:Linkwarden123!@postgres:5432/linkwarden?sslmode=disable&max_conns=20&max_idle_conns=4 | |
| - NEXTAUTH_SECRET=${NEXTAUTH_SECRET:-DR5o8dX6SR5#g*@7z!k2%8#sf5S@RR6F} | |
| - NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000} | |
| - PAGINATION_TAKE_COUNT | |
| - STORAGE_FOLDER | |
| - SPACES_KEY | |
| - SPACES_SECRET | |
| - SPACES_ENDPOINT | |
| - SPACES_REGION | |
| - NEXT_PUBLIC_EMAIL_PROVIDER | |
| - EMAIL_FROM | |
| - EMAIL_SERVER | |
| depends_on: | |
| postgres: | |
| condition: service_healthy | |
| linkwarden: | |
| <<: *linkwarden-service | |
| restart: unless-stopped | |
| command: start | |
| ports: | |
| - 3000:3000 | |
| depends_on: | |
| linkwarden-migrate: | |
| condition: service_completed_successfully |
@joekrill removing #main on line 28 actually enabled me to deploy this, so I think that is not correct.
If you manually perform: git clone https://github.com/linkwarden/linkwarden.git#main it performs a redirect. Removing this and linkwarden booted right up after changing my variables accordingly and using it in a portainer stack for deployment.
Thanks for this amazing compose file!
Hi thanks for the docker-compose.yml
I'm a beginner on this and i've got this error :
'
[internal] booting buildkit:
#0 15.61 time="2023-12-04T17:47:56Z" level=warning msg="using host network as the defaultime="2023-12-04T17:47:56Z" level=warning msg="using host network as the default"
#0 15.61 time="2023-12-04T17:47:56Z" level=warning msg="skipping containerd worker, as "/run/containerd/containerd.sock" does not exist"
#0 15.61 dtime="2023-12-04T17:47:56Z" level=info msg="found 1 workers, default="roasiizfn99ncnegkk2ig08dh""
#0 15.61 `time="2023-12-04T17:47:56Z" level=warning msg="currently, only the default worker can be used."
#0 15.61 \time="2023-12-04T17:47:56Z" level=info msg="running server on /run/buildkit/buildkitd.sock"
#0 15.61 time="2023-12-04T17:47:56Z" level=warning msg="skipping containerd worker, as "/run/containerd/containerd.sock" does not exist"
#0 15.61 time="2023-12-04T17:47:56Z" level=warning msg="currently, only the default worker can be used."
#0 15.61 time="2023-12-04T17:47:56Z" level=warning msg="currently, only the default worker can be used."
#0 15.61
http: invalid Host header`
I tried to add a parameter called "HOST" on the environment part. but it doesn't work.
When i used "docker compose logs linkwarden" i've this output :
linkwarden-linkwarden-1 | Error: P1001: Can't reach database server atpostgres:5432linkwarden-linkwarden-1 | linkwarden-linkwarden-1 | Please make sure your database server is running atpostgres:5432. linkwarden-linkwarden-1 | error Command failed with exit code 1. linkwarden-linkwarden-1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. linkwarden-linkwarden-1 | yarn run v1.22.19 linkwarden-linkwarden-1 | $ /data/node_modules/.bin/prisma migrate deploy linkwarden-linkwarden-1 | Prisma schema loaded from prisma/schema.prisma linkwarden-linkwarden-1 | Datasource "db": PostgreSQL database "postgres", schema "public" at "postgres:5432
i've made some update to be sure that linkwarden container is waiting for postgre container but i've this the same error (invalid host header)
Could you help me ?
Thanks in advance.
EDIT :
Hi, the host error seems to be dependent on the docker version. when i tried with docker 24.0.5 i didn't get the error anymore

Looks like branch has changed to 'main'.
Changing
context: https://github.com/linkwarden/linkwarden.gitfrom line 28 to:context: https://github.com/linkwarden/linkwarden.git#mainwill resolve any build errors.