Skip to content

Commit

Permalink
Upgrade docker compose experience
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Dec 4, 2024
1 parent f000a3d commit e2935ca
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 58 deletions.
23 changes: 23 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenID Connect OAuth 2.0
OPENID_CLIENT_ID=v3x-property
OPENID_CLIENT_SECRET=v3x-property-secret
OPENID_REDIRECT=http://0.0.0.0:3000/callback
OPENID_ISSUER=http://YOUR_IP_HERE:8080/realms/v3x-property

# Postgres Database
DATABASE_URL=postgres://postgres:postgres@postgres:5432/property

# Minio S3 (Defaults)
S3_ENDPOINT_URL=http://YOUR_IP_HERE:9000
S3_REGION=us-east-1
S3_BUCKET_NAME=property
S3_ACCESS_KEY=minioadmin
S3_SECRET_KEY=minioadmin

# Meilisearch (Optional)
MEILISEARCH_URL=http://YOUR_IP_HERE:7700
MEILISEARCH_MASTER_KEY=master

# Ollama (Optional)
OLLAMA_URL=http://YOUR_IP_HERE
OLLAMA_PORT=11434
59 changes: 33 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
# v3x-property

## Repo Dev
## Feature Support

### Prerequisites
- Meilisearch
- Ollama
- Minio S3

- Docker `docker`
- Docker Buildx `docker-buildx`
## Run your own instance

```sh
git clone https://github.com/v3xlabs/v3x-property
cp .env.example .env
docker compose up -d
```

## Developing Locally

This project consists of two parts:

- `engine`: A Rust application that runs the core logic and API.
- `web`: A Vite React (TS) application that runs the web interface.

To get started locally you need to have `docker` and `docker-compose` installed.

```sh
# Start Engine
cd engine
docker compose up -d # start the database
cargo sqlx migrate run # only required for development
cargo run # start the engine

# Start Web
cd web
pnpm install
pnpm dev
```

## Brainrot

Expand Down Expand Up @@ -54,25 +83,3 @@ An example of a tracked item could be:
"modified": "2023-06-01T00:00:00Z"
}
```

## Developing Locally

This project consists of two parts:

- `engine`: A Rust application that runs the core logic and API.
- `web`: A Vite React (TS) application that runs the web interface.

To get started locally you need to have `docker` and `docker-compose` installed.

```
# Start Engine
cd engine
docker compose up -d # start the database
cargo sqlx migrate run # only required for development
cargo run # start the engine
# Start Web
cd web
pnpm install
pnpm dev
```
95 changes: 95 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# runs the engine on port 3000
services:
# Engine
engine:
image: ghcr.io/v3xlabs/v3x-property-engine:master
ports:
- "3000:3000"
env_file: .env
depends_on:
postgres:
condition: service_healthy
keycloak-healthcheck:
condition: service_healthy

# Database
postgres:
image: postgres:17
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: property
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
interval: 5s
timeout: 5s
retries: 5

# Keycloak
keycloak:
image: quay.io/keycloak/keycloak:26.0
environment:
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://postgres:5432/postgres
KC_DB_USERNAME: postgres
KC_DB_PASSWORD: postgres

KC_HOSTNAME: keycloak
KC_HOSTNAME_PORT: 8080
KC_HOSTNAME_STRICT: false
KC_HOSTNAME_STRICT_HTTPS: false

KC_LOG_LEVEL: info
KC_METRICS_ENABLED: true
KC_HEALTH_ENABLED: true
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
command:
- start-dev
- --import-realm
volumes:
- ./engine/.build/realm-export.json:/opt/keycloak/data/import/realm-export.json
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy

keycloak-healthcheck:
image: curlimages/curl
command: ["sleep", "infinity"]
healthcheck:
test: ["CMD", "curl", "--head", "-fsS", "http://keycloak:9000/health/ready"]
interval: 5s
timeout: 5s
retries: 10
depends_on:
postgres:
condition: service_healthy

meilisearch:
image: getmeili/meilisearch:v1.11
environment:
MEILI_MASTER_KEY: master
ports:
- "7700:7700"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7700/health"]
interval: 5s
timeout: 5s
retries: 5

minio:
image: minio/minio:latest
command: server --console-address ":9001" /mnt/data
ports:
- "9000:9000"
- "9001:9001"
healthcheck:
test: ["CMD", "curl", "-I", "http://localhost:9000/minio/health/live"]
interval: 5s
timeout: 5s
retries: 5
2 changes: 1 addition & 1 deletion engine/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OPENID_CLIENT_ID=v3x-property
OPENID_CLIENT_SECRET=v3x-property-secret
OPENID_REDIRECT=http://localhost:3000/callback
OPENID_ISSUER=http://localhost:8080/realms/v3x-property/
OPENID_ISSUER=http://localhost:8080/realms/v3x-property

# Postgres Database
DATABASE_URL=postgres://postgres:postgres@localhost:5432/property
Expand Down
16 changes: 0 additions & 16 deletions engine/compose.prod.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions engine/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
# runs the engine on port 3000
services:
# Engine
# engine:
# image: ghcr.io/v3xlabs/v3x-property-engine:latest
# # build:
# # context: .
# # dockerfile: .build/Dockerfile
# ports:
# - "3000:3000"
# env_file: .env
# # OPENID_DISCOVERY_URL=http://localhost:8080/realms/master/.well-known/openid-configuration
# network_mode: host
# depends_on:
# - postgres
# - keycloak

# Database
postgres:
image: postgres:17
Expand Down

0 comments on commit e2935ca

Please sign in to comment.