-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local app services #429
Merged
Merged
Local app services #429
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7b4c7ce
Run a postgres in docker compose
sjmiller609 73b31b2
Traefik dashboard access
sjmiller609 28ae375
connect through traefik to postgres
sjmiller609 38b6c1d
Two postgres servers, same port
sjmiller609 6d99a81
Add comments
sjmiller609 a1d661d
Add sample app service
sjmiller609 1d3fcdf
add comment
sjmiller609 84a139c
Add more comment
sjmiller609 3c62a42
Ignore in workflow
sjmiller609 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,88 @@ | ||
# Maybe actually using docker compose is the way to go, or maybe you want to | ||
# do it all in just docker. Perhaps compose is better if that's more hackable | ||
# since after generating with CLI, then a user can see how it all works. | ||
# And if you don't use compose, then you end up re-implementing a lot of what's | ||
# already in docker compose, like building and running several containers from | ||
# a single config. | ||
version: '3.8' | ||
|
||
services: | ||
|
||
instance-1: | ||
build: | ||
context: ./instance-1 | ||
networks: | ||
- tembo | ||
labels: | ||
- "traefik.enable=true" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wonder what traefik options need to be exposed in tembo.toml. I guess as I implement it might become clearer. |
||
# an 'A' record *.local.tembo.io is set to 127.0.0.1 | ||
# connect with TLS passthrough, SNI into local instance. | ||
# TLS termination inside postgres container. | ||
- "traefik.tcp.routers.instance-1.rule=HostSNI(`instance-1.local.tembo.io`)" | ||
- "traefik.tcp.routers.instance-1.entrypoints=postgresql" | ||
- "traefik.tcp.routers.instance-1.tls.passthrough=true" | ||
- "traefik.tcp.services.instance-1.loadbalancer.server.port=5432" | ||
|
||
instance-1-postgrest: | ||
image: postgrest/postgrest:v10.0.0 | ||
environment: | ||
PGRST_DB_URI: "postgresql://postgres:postgres@instance-1:5432/postgres" | ||
PGRST_DB_SCHEMA: "public, graphql" | ||
PGRST_DB_ANON_ROLE: "postgres" | ||
PGRST_LOG_LEVEL: "info" | ||
networks: | ||
- tembo | ||
labels: | ||
- "traefik.enable=true" | ||
# The settings here depends on the app service settings | ||
- "traefik.http.routers.instance-1-postgrest.rule=Host(`instance-1.local.tembo.io`) && (PathPrefix(`/rest/v1`) || PathPrefix(`/graphql/v1`))" | ||
# in cloud, this is websecure instead of just web | ||
- "traefik.http.routers.instance-1-postgrest.entrypoints=web" | ||
- "traefik.http.services.instance-1-postgrest.loadbalancer.server.port=3000" | ||
- "traefik.http.middlewares.postgrest-stripprefix.stripprefix.prefixes=/rest/v1, /graphql/v1" | ||
- "traefik.http.routers.postgrest.middlewares=postgrest-stripprefix" | ||
|
||
instance-2: | ||
build: | ||
context: ./instance-2 | ||
networks: | ||
- tembo | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.tcp.routers.instance-2.rule=HostSNI(`instance-2.local.tembo.io`)" | ||
- "traefik.tcp.routers.instance-2.entrypoints=postgresql" | ||
- "traefik.tcp.routers.instance-2.tls.passthrough=true" | ||
- "traefik.tcp.services.instance-2.loadbalancer.server.port=5432" | ||
|
||
traefik: | ||
image: traefik:v3.0.0-beta2 | ||
networks: | ||
- tembo | ||
command: | ||
# Traefik can make routing rules by talking to | ||
# Docker. We also connect Docker socket to container. | ||
- "--providers.docker=true" | ||
- "--providers.docker.exposedbydefault=false" | ||
# These are all the ports we can use for local dev | ||
- "--entrypoints.ferretdb.address=:27018/tcp" | ||
- "--entrypoints.postgresql.address=:5432/tcp" | ||
- "--entrypoints.traefik.address=:9000/tcp" | ||
- "--entrypoints.web.address=:8000/tcp" | ||
- "--api.dashboard=true" | ||
- "--api.insecure=true" | ||
# This could be enabled with debug mode on | ||
# - "--accesslog=true" | ||
# - "--log.level=DEBUG" | ||
volumes: | ||
- "/var/run/docker.sock:/var/run/docker.sock:ro" | ||
ports: | ||
- "8000:8000" | ||
# Traefik dashboard at http://localhost:9000/dashboard/ | ||
# helpful for troubleshooting Traefik configurations | ||
- "9000:9000" | ||
- "5432:5432" | ||
# FerretDB port | ||
- "27018:27018" | ||
|
||
networks: | ||
tembo: {} |
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,5 @@ | ||
FROM quay.io/tembo/tembo-local:latest | ||
|
||
RUN trunk install pg_partman | ||
|
||
COPY custom.conf $PGDATA/extra-configs |
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 @@ | ||
shared_preload_libraries = 'pg_partman_bgw' |
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,5 @@ | ||
FROM quay.io/tembo/tembo-local:latest | ||
|
||
RUN trunk install pg_partman | ||
|
||
COPY custom.conf $PGDATA/extra-configs |
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 @@ | ||
shared_preload_libraries = 'pg_partman_bgw' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed docker-compose is a better way to go got these use cases