Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpiac committed Sep 27, 2023
2 parents 00a7629 + 8b8d0d8 commit cff981c
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 52 deletions.
32 changes: 22 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
PORT=8080

CONSOLE_IMAGE=ghcr.io/agentlabs-dev/agentlabs-poc/console:latest

FRONTEND_IMAGE=ghcr.io/agentlabs-dev/agentlabs-poc/frontend:latest

SERVER_IMAGE=ghcr.io/agentlabs-dev/agentlabs-poc/server:latest

# ----------------------
# Database configuration
Expand All @@ -24,12 +20,6 @@ POSTGRES_PORT=5432
# You should not have to change this unless you are using an external database.
POSTGRES_HOST=postgres

# ----------------------
# Misc configuration
# ----------------------

OPENAI_API_KEY=

# ----------------------
# Backend Server Configuration
# ----------------------
Expand All @@ -44,9 +34,31 @@ PUBLIC_AI_AGENT_DOMAIN=app.agentlabs.dev

# ----------------------
# For development only - if you are not contributing to Agentlabs, you can freely ignore this!
# - Image configuration -
# Unless you really know what you are doing you probaby do not want to
# mess with that.
# ----------------------

CONSOLE_IMAGE=ghcr.io/agentlabs-inc/agentlabs/console:latest

FRONTEND_IMAGE=ghcr.io/agentlabs-inc/agentlabs/frontend:latest

SERVER_IMAGE=ghcr.io/agentlabs-inc/agentlabs/server:latest

CADDY_IMAGE=caddy:2.7.4-alpine

POSTGRES_IMAGE=postgres:16rc1-alpine3.18

DEV_FRONTEND_PORT=3000
DEV_CONSOLE_PORT=3002
DEV_SERVER_PORT=3001
DEV_POSTGRES_PORT=5432

# ----------------------
# - Agentlabs cloud configuration options -
# Unless you work at Agentlabs this part is not for you.
# ----------------------

CLOUD_APP_WILDCARD_DOMAIN=
CLOUD_CONSOLE_URL=
CLOUD_APP_WILDCARD_DOMAIN_DNS_API_KEY=
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.env.local
node_modules

gen-api
gen-api
caddy/data
17 changes: 17 additions & 0 deletions caddy/config/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:80 {
handle_path /api/* {
reverse_proxy server:3000
}

handle /socket.io/* {
reverse_proxy server:3000
}

handle /console/* {
reverse_proxy console:3000
}

handle {
reverse_proxy frontend:3000
}
}
30 changes: 30 additions & 0 deletions cloud-proxy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{$CLOUD_APP_WILDCARD_DOMAIN}:443 {
tls {
dns godaddy {$CLOUD_APP_WILDCARD_DOMAIN_DNS_API_KEY}
}

reverse_proxy gateway
}

{$CLOUD_CONSOLE_URL}:443 {
@console {
path /console/*
}

@api {
path /api/*
}

handle @console {
reverse_proxy gateway
}

handle @api {
reverse_proxy gateway
}

handle {
rewrite * /console{path}
reverse_proxy gateway
}
}
8 changes: 8 additions & 0 deletions cloud-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM caddy:2.7.4-builder-alpine as builder

RUN xcaddy build \
--with github.com/caddy-dns/godaddy

FROM caddy:2.7.4-alpine

COPY --from=builder /usr/bin/caddy /usr/bin/caddy
64 changes: 64 additions & 0 deletions docker-compose.cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: '3.8'

volumes:
postgres-data:

services:

cloud-proxy:
# TODO: build cloud proxy image in a pipeline and turn it into a proper package
# Not urgent as this is used only to host the cloud version.
build:
context: cloud-proxy
volumes:
- ./cloud-proxy/Caddyfile:/etc/caddy/Caddyfile
ports:
- 80:80
- 443:443
depends_on:
- gateway
environment:
- CLOUD_CONSOLE_URL=${CLOUD_CONSOLE_URL}
- CLOUD_APP_WILDCARD_DOMAIN=${CLOUD_APP_WILDCARD_DOMAIN}
- CLOUD_APP_WILDCARD_DOMAIN_DNS_API_KEY=${CLOUD_APP_WILDCARD_DOMAIN_DNS_API_KEY}
restart: unless-stopped

gateway:
image: ${CADDY_IMAGE}
volumes:
- ./caddy/config/Caddyfile:/etc/caddy/Caddyfile
depends_on:
- frontend
- server
restart: unless-stopped

postgres:
image: ${POSTGRES_IMAGE}
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres-data:/var/lib/postgresql/data
restart: unless-stopped

server:
image: ${SERVER_IMAGE}
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}
- USERS_ACCESS_TOKEN_SECRET=${USERS_ACCESS_TOKEN_SECRET}
depends_on:
- postgres
restart: unless-stopped

frontend:
image: ${FRONTEND_IMAGE}
depends_on:
- server
restart: unless-stopped

console:
image: ${CONSOLE_IMAGE}
depends_on:
- server
restart: unless-stopped
19 changes: 6 additions & 13 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
version: '3.8'

volumes:
postgres-data-dev:

services:

gateway:
image: nginx:1.25.2-alpine
hostname: gateway
image: ${CADDY_IMAGE}
container_name: gateway-dev
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
ports:
- ${PORT}:80
- ./caddy/config/Caddyfile:/etc/caddy/Caddyfile
depends_on:
- frontend
- console
- server
restart: unless-stopped

postgres:
image: postgres:16rc1-alpine3.18
hostname: postgres
image: ${POSTGRES_IMAGE}
container_name: postgres-dev
environment:
- POSTGRES_USER=${POSTGRES_USER}
Expand All @@ -32,7 +30,6 @@ services:

server:
container_name: server-dev
hostname: server
build:
context: ./server
dockerfile: Dockerfile.dev
Expand All @@ -47,7 +44,6 @@ services:

frontend:
container_name: frontend-dev
hostname: frontend
build:
context: ./frontend
dockerfile: Dockerfile.dev
Expand All @@ -74,6 +70,3 @@ services:
depends_on:
- server
restart: unless-stopped

volumes:
postgres-data-dev:
46 changes: 18 additions & 28 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
version: '3.8'

volumes:
postgres-data:

services:

gateway:
image: nginx:1.25.2-alpine
hostname: gateway
container_name: gateway
image: ${CADDY_IMAGE}
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./caddy/config/Caddyfile:/etc/caddy/Caddyfile
ports:
- ${PORT}:80
depends_on:
- frontend
- server
restart: unless-stopped

frontend:
image: ${FRONTEND_IMAGE}
depends_on:
- server
restart: unless-stopped

console:
image: ${CONSOLE_IMAGE}
depends_on:
- server
restart: unless-stopped

postgres:
image: postgres:16rc1-alpine3.18
hostname: postgres
container_name: postgres
image: ${POSTGRES_IMAGE}
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
Expand All @@ -28,31 +39,10 @@ services:
restart: unless-stopped

server:
container_name: server
hostname: server
image: ${SERVER_IMAGE}
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}
- USERS_ACCESS_TOKEN_SECRET=${USERS_ACCESS_TOKEN_SECRET}
depends_on:
- postgres
restart: unless-stopped

frontend:
container_name: frontend
hostname: frontend
image: ${FRONTEND_IMAGE}
depends_on:
- server
restart: unless-stopped

console:
container_name: console
hostname: console
image: ${CONSOLE_IMAGE}
depends_on:
- server
restart: unless-stopped

volumes:
postgres-data:

0 comments on commit cff981c

Please sign in to comment.