Skip to content

Commit

Permalink
feat: add ability to self host with a different postgres & redis inst…
Browse files Browse the repository at this point in the history
…ance (#423)
  • Loading branch information
jatinsandilya authored Jan 4, 2024
1 parent ca71c6a commit 07e72b4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
2 changes: 2 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 59 additions & 0 deletions fern/docs/contents/docker-compose.mdx
Original file line number Diff line number Diff line change
@@ -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://<PG_USER>:<PG_PASSWORD>@<PG_HOST>:<PG_PORT>/<PG_DB> \
revertengg/revert-db-seed:latest

# To run Revert API:

docker run \
-v cache:/data \
-v pgdata:/var/lib/postgresql/data \
-e PGSQL_URL=postgresql://<PG_USER>:<PG_PASSWORD>@<PG_HOST>:<PG_PORT>/<PG_DB> \
-e REDIS_SERVER_URL=redis://<REDIS_USER>:<REDIS_PASSWORD>@<REDIS_HOST>:<REDIS_PORT> \
revertengg/revert-api-ce:latest

```

1 comment on commit 07e72b4

@vercel
Copy link

@vercel vercel bot commented on 07e72b4 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

revert-client – ./

revert-client-git-main-revertdev.vercel.app
revert-client-revertdev.vercel.app
app.revert.dev

Please sign in to comment.