From 07e72b499bfbdbf69d7cb01a7c2990e31abc5347 Mon Sep 17 00:00:00 2001 From: Jatin Sandilya <7681067+jatinsandilya@users.noreply.github.com> Date: Thu, 4 Jan 2024 16:35:22 +0530 Subject: [PATCH] feat: add ability to self host with a different postgres & redis instance (#423) --- docker-compose.yml | 1 + fern/docs.yml | 2 + fern/docs/contents/docker-compose.mdx | 59 +++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 fern/docs/contents/docker-compose.mdx diff --git a/docker-compose.yml b/docker-compose.yml index 513bd4eaf..9acc4b010 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,7 @@ services: context: "./" args: PGSQL_URL: postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DATABASE} + image: revertengg/revert-db-seed depends_on: - db profiles: [ "tools" ] diff --git a/fern/docs.yml b/fern/docs.yml index 5302d8529..54945986f 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -48,6 +48,8 @@ navigation: contents: - page: Developer Guide path: ./docs/contents/developer-guides.mdx + - page: Self Host Revert + path: ./docs/contents/docker-compose.mdx - section: CRM Support contents: - page: CRM Support diff --git a/fern/docs/contents/docker-compose.mdx b/fern/docs/contents/docker-compose.mdx new file mode 100644 index 000000000..a05df0713 --- /dev/null +++ b/fern/docs/contents/docker-compose.mdx @@ -0,0 +1,59 @@ +#### Spinning up Revert with docker-compose locally + +The easiest way to start with self-hosted Revert is to run it via docker-compose: + +```shell +# Get the code +git clone --depth 1 https://github.com/revertinc/revert + +# Copy the example env file +cd revert +cp .env.example .env +cp packages/backend/.env.example packages/backend/.env +cp packages/client/.env.example packages/client/.env +cp packages/js/.env.example packages/js/.env +cp packages/react/.env.example packages/react/.env +cp packages/vue/.env.example packages/vue/.env + +# Ensure that clerk is setup in `client` and a user is created by following the instructions here: https://docs.revert.dev/overview/developer-guide/developer-guide#-revertdotdev-client + +# Update these .env files with any of your own secrets if you'd like to. + +# Then In the root directory run + +# When running for the first time to seed the database. (RUN ONLY ONCE) +docker-compose run db-seed + +# For subsequent runs +docker-compose up -d + +``` + +The UI is now available at http://localhost:3000 and the backend is available at http://localhost:4001. This also contains a postgres database alongside the API. + + +#### Run Revert with your own database & redis + +The above steps allow you to spin up a postgres & redis instance alongside the API and UI. + +To use your own postgres & redis instance run the following set of commands: + + +```shell + +# Seed the database + +docker run \ + -e PGSQL_URL=postgresql://:@:/ \ + revertengg/revert-db-seed:latest + +# To run Revert API: + +docker run \ + -v cache:/data \ + -v pgdata:/var/lib/postgresql/data \ + -e PGSQL_URL=postgresql://:@:/ \ + -e REDIS_SERVER_URL=redis://:@: \ + revertengg/revert-api-ce:latest + +```