-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example code for running locally
- Loading branch information
1 parent
8300f37
commit 2368627
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM quay.io/tembo/tembo-pg-cnpg:latest | ||
|
||
USER root | ||
RUN chown -R postgres:postgres $PGDATA && \ | ||
chmod -R 0700 $PGDATA | ||
ENV PGDATA /var/lib/postgresql/data2 | ||
RUN mkdir -p $PGDATA | ||
RUN chown -R postgres:postgres $PGDATA && \ | ||
chmod -R 0700 $PGDATA | ||
USER postgres | ||
RUN pg_ctl init | ||
# Set permissive authentication | ||
RUN echo "host all all 0.0.0.0/0 trust" >> ${PGDATA}/pg_hba.conf | ||
COPY postgresql.conf ${PGDATA}/postgresql.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Running Tembo locally | ||
|
||
This guide is for running a PostgreSQL container locally that supports installing extensions with Trunk. This guide uses Docker Compose to start the same image used in Tembo Cloud on your local machine, and provides guidance on how to manually install and enable extensions. We are also working on a Tembo CLI that will replace this workflow. | ||
|
||
## Starting PostgreSQL and connect | ||
|
||
- Checkout this directory using git, or duplicate the files in a local directory | ||
- Start a PostgreSQL container locally like this | ||
``` | ||
docker-compose up --build -d | ||
``` | ||
- The above command will fail if you already have something running on port 5432 | ||
- Now, you can connect to your database with this command: | ||
``` | ||
psql postgres://postgres:postgres@localhost:5432 | ||
``` | ||
|
||
## Install extensions with Trunk | ||
|
||
- Shell into postgres container | ||
``` | ||
docker exec -it local-tembo /bin/bash | ||
``` | ||
|
||
- Trunk install something | ||
``` | ||
trunk install pgmq | ||
``` | ||
|
||
## Enabling extensions | ||
|
||
- Connect to postgres, this works from inside or outside the container. | ||
``` | ||
psql postgres://postgres:postgres@localhost:5432 | ||
``` | ||
- Enable an extension | ||
``` | ||
CREATE EXTENSION pgmq CASCADE; | ||
``` | ||
- List enabled extensions | ||
``` | ||
\dx | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: '3' | ||
|
||
services: | ||
local-tembo: | ||
container_name: local-tembo | ||
build: . | ||
ports: | ||
- "5432:5432" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
listen_addresses = '*' |