From 24ac3c145154da4bb164c4cfdae8374fb2a9a3d3 Mon Sep 17 00:00:00 2001 From: Anatoli Nicolae Date: Wed, 20 Mar 2024 17:30:00 +0100 Subject: [PATCH] Improve Docker docs Signed-off-by: Anatoli Nicolae Fix broken links Signed-off-by: Anatoli Nicolae Fix note and code block Signed-off-by: Anatoli Nicolae Link referenced section Signed-off-by: Anatoli Nicolae --- docs/docker.md | 78 ++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/docs/docker.md b/docs/docker.md index 3e5bdf0ee..b7326b750 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -6,55 +6,57 @@ ## Prerequisites > [!IMPORTANT] -> If you want to run shelf via docker, there are still some prerequisites you need to meet. Because our docker setup doesn't currently support self-hosting supabase, you need to complete the steps below. This means you have to take care of setting up your supabase environment, running migrations against your database, and making sure Supabase is configured based on our requirements. +> If you want to run shelf via docker, there are still some prerequisites you need to meet. Because our docker setup doesn't currently support self-hosting supabase, you need to complete the steps below. This means you have to take care of setting up your Supabase environment, running migrations against your database, and making sure Supabase is configured based on our requirements. -1. https://github.com/Shelf-nu/shelf.nu/blob/main/docs/get-started.md#development -2. https://github.com/Shelf-nu/shelf.nu/blob/main/docs/get-started.md#authentication +1. [Get Started > Development](./get-started.md#development) +2. [Get Started > Authentication](./get-started.md#authentication) This will make sure you have a DATABASE that you are ready to connect to. ## Instructions -1. Make sure you have docker installed on your machine -2. Use the docker run command and replace your env varibales: - -```sh -docker run -d \ - --name "shelf" \ - -e "DATABASE_URL=postgres://{USER}:{PASSWORD}@{HOST}:6543/{DB_NAME}?pgbouncer=true" \ - -e "DIRECT_URL=postgres://{USER}:{PASSWORD}@{HOST}:5432/{DB_NAME}" \ - -e 'SUPABASE_ANON_PUBLIC=ANON_PUBLIC' \ - -e 'SUPABASE_SERVICE_ROLE=SERVICE_ROLE' \ - -e 'SUPABASE_URL=https://{YOUR_INSTANCE_NAME}.supabase.co' \ - -e 'SESSION_SECRET=super-duper-s3cret' \ - -e 'SERVER_URL=http://localhost:3000' \ - -e 'MAPTILER_TOKEN=maptiler-token' \ - -e 'SMTP_HOST=mail.example.com' \ - -e 'SMTP_USER=some-email@example.com' \ - -e 'SMTP_FROM="Carlos from shelf.nu" ' \ - -e 'SMTP_PWD=super-safe-passw0rd' \ - -e 'NODE_ENV=production' \ - -p 3000:8080 \ - --restart unless-stopped \ - ghcr.io/shelf-nu/shelf.nu:latest -``` +1. Make sure you have Docker installed on your machine +2. Use the `docker run` command and replace your env varibales: + ```sh + docker run -d \ + --name "shelf" \ + -e "DATABASE_URL=postgres://{USER}:{PASSWORD}@{HOST}:6543/{DB_NAME}?pgbouncer=true" \ + -e "DIRECT_URL=postgres://{USER}:{PASSWORD}@{HOST}:5432/{DB_NAME}" \ + -e 'SUPABASE_ANON_PUBLIC=ANON_PUBLIC' \ + -e 'SUPABASE_SERVICE_ROLE=SERVICE_ROLE' \ + -e 'SUPABASE_URL=https://{YOUR_INSTANCE_NAME}.supabase.co' \ + -e 'SESSION_SECRET=super-duper-s3cret' \ + -e 'SERVER_URL=http://localhost:3000' \ + -e 'MAPTILER_TOKEN=maptiler-token' \ + -e 'SMTP_HOST=mail.example.com' \ + -e 'SMTP_USER=some-email@example.com' \ + -e 'SMTP_FROM="Carlos from shelf.nu" ' \ + -e 'SMTP_PWD=super-safe-passw0rd' \ + -p 3000:8080 \ + --restart unless-stopped \ + ghcr.io/shelf-nu/shelf.nu:latest + ``` +> [!NOTE] +> `DATABASE_URL` and `DIRECT_URL` are mandatory when using Supabase Cloud. Learn more in [Get Started > Development](./get-started.md#development) section. +3. Run the following command to seed the database (create initial user), **only once after the first deployment**: + ```sh + docker exec -it shelf npm run setup:seed + ``` ### ARM processors You can also run shelf on ARM64 processors. 1. Linux / Pine A64 - -```shell -root@DietPi:~# -docker run -it --rm --entrypoint /usr/bin/uname ghcr.io/thundersquared/shelf:latest -a -Linux 77ae434f8fe9 6.1.63-current-sunxi64 #1 SMP Mon Nov 20 10:52:19 UTC 2023 aarch64 GNU/Linux -``` + ```sh + root@DietPi:~# + docker run -it --rm --entrypoint /usr/bin/uname ghcr.io/shelf-nu/shelf.nu:latest -a + Linux 77ae434f8fe9 6.1.63-current-sunxi64 #1 SMP Mon Nov 20 10:52:19 UTC 2023 aarch64 GNU/Linux + ``` 2. MacOS / M1 Max - -```shell -❯ ~ -docker run -it --rm --platform linux/arm64 --entrypoint /usr/bin/uname ghcr.io/thundersquared/shelf:latest -a -Linux 7a9dff819847 6.5.13-orbstack-00122-g57b8027e2387 #1 SMP Tue Feb 6 07:48:26 UTC 2024 aarch64 GNU/Linux -``` + ```sh + ❯ ~ + docker run -it --rm --platform linux/arm64 --entrypoint /usr/bin/uname ghcr.io/shelf-nu/shelf.nu:latest -a + Linux 7a9dff819847 6.5.13-orbstack-00122-g57b8027e2387 #1 SMP Tue Feb 6 07:48:26 UTC 2024 aarch64 GNU/Linux + ```