removed docker compose dependency and added dedicated pgvector db
This commit is contained in:
@@ -33,9 +33,7 @@ dependencies {
|
|||||||
implementation("org.springframework.ai:spring-ai-starter-model-openai")
|
implementation("org.springframework.ai:spring-ai-starter-model-openai")
|
||||||
compileOnly("org.projectlombok:lombok")
|
compileOnly("org.projectlombok:lombok")
|
||||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||||
// developmentOnly("org.springframework.boot:spring-boot-docker-compose")
|
|
||||||
runtimeOnly("org.postgresql:postgresql")
|
runtimeOnly("org.postgresql:postgresql")
|
||||||
// developmentOnly("org.springframework.ai:spring-ai-spring-boot-docker-compose")
|
|
||||||
annotationProcessor("org.projectlombok:lombok")
|
annotationProcessor("org.projectlombok:lombok")
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
|
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
|
||||||
// testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
// testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
services:
|
services:
|
||||||
postgres:
|
vaessl-db:
|
||||||
image: 'postgres:latest'
|
image: 'pgvector/pgvector:pg18'
|
||||||
environment:
|
environment:
|
||||||
- 'POSTGRES_DB=mydatabase'
|
- 'POSTGRES_DB=vaessl'
|
||||||
- 'POSTGRES_PASSWORD=secret'
|
- 'POSTGRES_PASSWORD=password'
|
||||||
- 'POSTGRES_USER=myuser'
|
- 'POSTGRES_USER=user'
|
||||||
ports:
|
ports:
|
||||||
- '5432'
|
- '5432'
|
||||||
|
labels:
|
||||||
|
- "org.springframework.boot.service-connection=postgres"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This app will use the current latest version 4.0.4 of Spring Boot and the latest OpenJDK 25 LTS.
|
This app will use the current latest version 4.0.4 of Spring Boot and the latest OpenJDK 25 LTS.
|
||||||
|
|
||||||
The dependencies are chosen to specifically work with Spring AI, PostgreSQL and Docker. For the AI function OpenAI is chosen since it is known to work with LiteLLM. The PostgreSQL dependency makes sure to include PostGreSQL support for self hosted databases. Docker Compose makes sure to handle future Docker implementations.
|
The dependencies are chosen to specifically work with Spring AI and PostgreSQL/pgvector. For the AI function OpenAI is chosen since it is known to work with LiteLLM. The PostgreSQL dependency makes sure to include PostGreSQL support for self hosted databases.
|
||||||
|
|
||||||
# Spring Initializr settings
|
# Spring Initializr settings
|
||||||
|
|
||||||
@@ -22,7 +22,6 @@ Gradel Kotlin is chosen to make mobile/Android app development easier.
|
|||||||
|
|
||||||
- Lombok
|
- Lombok
|
||||||
- Spring Boot DevTools
|
- Spring Boot DevTools
|
||||||
- Docker Compose Support
|
|
||||||
- Spring Web
|
- Spring Web
|
||||||
- Spring Security
|
- Spring Security
|
||||||
- Spring Data JPA
|
- Spring Data JPA
|
||||||
@@ -32,7 +31,7 @@ Gradel Kotlin is chosen to make mobile/Android app development easier.
|
|||||||
|
|
||||||
# Project Settings
|
# Project Settings
|
||||||
|
|
||||||
Docker Compose, PostGreSQL and OpenAI need an initial setup so that the local instance is able to start. Since I will handle Docker issues later I will comment the dependencies out for now. I will also comment out Spring Security since user management is an issue for a later iteration of the app.
|
PostGreSQL and OpenAI need an initial setup so that the local instance is able to start. I will comment out Spring Security since user management is an issue for a later iteration of the app.
|
||||||
|
|
||||||
The build.gradle.kts will look something like this:
|
The build.gradle.kts will look something like this:
|
||||||
|
|
||||||
@@ -72,9 +71,7 @@ dependencies {
|
|||||||
implementation("org.springframework.ai:spring-ai-starter-model-openai")
|
implementation("org.springframework.ai:spring-ai-starter-model-openai")
|
||||||
compileOnly("org.projectlombok:lombok")
|
compileOnly("org.projectlombok:lombok")
|
||||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||||
// developmentOnly("org.springframework.boot:spring-boot-docker-compose")
|
|
||||||
runtimeOnly("org.postgresql:postgresql")
|
runtimeOnly("org.postgresql:postgresql")
|
||||||
// developmentOnly("org.springframework.ai:spring-ai-spring-boot-docker-compose")
|
|
||||||
annotationProcessor("org.projectlombok:lombok")
|
annotationProcessor("org.projectlombok:lombok")
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
|
testImplementation("org.springframework.boot:spring-boot-starter-data-jpa-test")
|
||||||
// testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
// testImplementation("org.springframework.boot:spring-boot-starter-security-test")
|
||||||
@@ -98,7 +95,7 @@ tasks.withType<Test> {
|
|||||||
To configure OpenAI (which I will use instead of LiteLLM initially since I have an OpenAI Api key and can get going quickly) and PostGreSQL I will create a .env_dev file in the root dir, fill all credentials and add it to .gitignore
|
To configure OpenAI (which I will use instead of LiteLLM initially since I have an OpenAI Api key and can get going quickly) and PostGreSQL I will create a .env_dev file in the root dir, fill all credentials and add it to .gitignore
|
||||||
|
|
||||||
```
|
```
|
||||||
DB_URL=jdbc:postgresql://192.168.1.208:5432/vaessl-playground
|
DB_URL=jdbc:postgresql://192.168.1.208:5433/vaessl
|
||||||
DB_USERNAME=myusername
|
DB_USERNAME=myusername
|
||||||
DB_PASSWORD=mypw
|
DB_PASSWORD=mypw
|
||||||
OPENAI_KEY=myapikey
|
OPENAI_KEY=myapikey
|
||||||
@@ -139,7 +136,52 @@ spring:
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that I'm using my own locally hosted PostgreSQL instance here and created a dedicated db for this project. There is a Docker Compose config with the Spring Boot dependency for this but since my DB is always on and running independently I don't need the Docker Compose management.
|
Note that I'm using my own locally hosted PostgreSQL instance here and created a dedicated db for this project. The Docker Compose file will look something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
code-server:
|
||||||
|
image: code-server-dev:latest
|
||||||
|
container_name: code-server
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Vienna
|
||||||
|
# - PASSWORD= #optional
|
||||||
|
- HASHED_PASSWORD=hashedpw
|
||||||
|
# - SUDO_PASSWORD_HASH= #optional
|
||||||
|
- PROXY_DOMAIN=code-server.your.website
|
||||||
|
- DEFAULT_WORKSPACE=/config/workspace
|
||||||
|
volumes:
|
||||||
|
- /home/pi/docker/vscode:/config
|
||||||
|
- /home/pi/docker/vscode/workspace:/workspace
|
||||||
|
ports:
|
||||||
|
- 8443:8443
|
||||||
|
- 8124:8080
|
||||||
|
- 5173:5173
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
vaessl-db:
|
||||||
|
image: pgvector/pgvector:pg18
|
||||||
|
container_name: vaessl-db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=vaessl
|
||||||
|
- POSTGRES_USER=user
|
||||||
|
- POSTGRES_PASSWORD=pw
|
||||||
|
ports:
|
||||||
|
- 5433:5432
|
||||||
|
|
||||||
|
vassal-test-db:
|
||||||
|
image: pgvector/pgvector:pg18
|
||||||
|
container_name: vassal-test-db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=vassal_test
|
||||||
|
- POSTGRES_USER=user
|
||||||
|
- POSTGRES_PASSWORD=pw
|
||||||
|
ports:
|
||||||
|
- 5434:5432
|
||||||
|
```
|
||||||
|
|
||||||
# Appendix: Additional config for developing in Code-Server
|
# Appendix: Additional config for developing in Code-Server
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user