Self Hosting
KeepLink is build with Supabase stack and Next.js, But It cannot depoly directly on vercel.com and supabase.io (at least for now) for two reason.
- KeepLink use rum index and zhparser for better search support which is not currently exist in Supabase's extensions list.
- Vercel's API route has 10 seconds runtime limit for its hobby plain. Archiving page with headless chrome might reach this limit. Maybe it can be solved by Supabase Workflows.
If you really want to deploy on vercel.com and https://supabase.io, which need some code change and database knowledge. Changing the SQL structure in prisma/migrations
as follw:
- Replace all
rum
index togin
index - Replace all
zhparser
text search config to one PostgreSQL builtin.
docker # Supabase directory
├── docker-compose.yml
├── kong
│ ├── Dockerfile
│ └── kong.yml
└── postgres
| ├── 00-initial-schema.sql
│ ├── 200-init-zhparser.sql
│ ├── 201-init-rum.sql
│ ├── auth-schema.sql
│ └── Dockerfile
└── docker-compose.yml
The repository contain a docker
directory with a docker-compose.yml in it. There is also a docker-compose.yml
in the root directory.
docker
directory is the directory of Supabase. Supabase has a great self host document for you. And the docker-compose.yml
in root directory open the KeepLink service and connenct to Supabase docker services by docker network.
- Install docker and docker-compose
- Run
git clone https://github.com/fengkx/keeplink
- First of all, CHANGE THE DEFAULT PASSWORD AND SECRET listed in Supabase Docs
- Run
docker-compose up -d
indocker
directory to start Supabase - Create
.env
file According to your environment and password and sercet. For example
NEXT_PUBLIC_SUPABASE_URL=https://supabase.keeplink.cc
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoiYW5vbiJ9.gCm8Egtn7aeHyz-Pq8QbqxpzSnMK3DffadQsBK9ainY
SUPABASE_PRIVATEKEY=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJyb2xlIjoic2VydmljZV9yb2xlIn0.WiEF94VgCZWE_IvPZinXSfpTj4mrVVRktGDQwWaEpl4
DATABASE_URL=postgres://postgres:postgres@db:5432/postgres?schema=public
CHROME_WS_URL=ws://chrome:3000
BASE_URL=https://app.keeplink.cc
Notice that in docker-compose network, You can use key in services
field to access that service.
- Run
docker-compose up -d
in root directory to start KeepLink (It might take some time to runnext build
)
Then KeepLink is running on port 3000 and Supabase is runing on port 8000
- Generate a long enough super secret string such as a uuid
- Paste the default jwt to https://jwt.io/#debugger-io and replace the sercet with the one you generated last step. It will generate a new one for you
- Replace all secret and jwt with your newly generated one
Notice: There are two jwt. One is NEXT_PUBLIC_SUPABASE_ANON_KEY
which is public and it is the one in kong/kong.yml
, the other one is SUPABASE_PRIVATEKEY
which is private and should be super sercet
- Replace the PostgreSQL password and other password as well
More useful configuration on https://github.com/fengkx/keeplink/wiki/Useful-Configuration