Skip to content

Commit

Permalink
Improve Docker docs
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoli Nicolae <[email protected]>

Fix broken links

Signed-off-by: Anatoli Nicolae <[email protected]>

Fix note and code block

Signed-off-by: Anatoli Nicolae <[email protected]>

Link referenced section

Signed-off-by: Anatoli Nicolae <[email protected]>
  • Loading branch information
anatolinicolae committed Mar 21, 2024
1 parent 1dcd3af commit 24ac3c1
Showing 1 changed file with 40 additions and 38 deletions.
78 changes: 40 additions & 38 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 '[email protected]' \
-e 'SMTP_FROM="Carlos from shelf.nu" <[email protected]>' \
-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 '[email protected]' \
-e 'SMTP_FROM="Carlos from shelf.nu" <[email protected]>' \
-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
```

0 comments on commit 24ac3c1

Please sign in to comment.