Skip to content

Commit 75f66ce

Browse files
authored
Fix fulltext search - broken host parameters (#318)
1 parent aaf2f99 commit 75f66ce

9 files changed

Lines changed: 21 additions & 63 deletions

File tree

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ POSTGRES_DB=findfirst
44
SPRING_PROFILES_ACTIVE=dev
55
SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
66
SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
7-
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/findfirst
7+
SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/findfirst
88
SCREENSHOT_SERVICE_URL=http://screenshot:8080/
9+
TYPESENSE_SERVICE_HOST=typesense
910
TYPESENSE_API_KEY=xyz

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ ifeq ( ,$(wildcard $(CERT_FILE)))
1616
@echo ">Creating certificates"
1717
cd ./server/scripts && ./createServerKeys.sh
1818
endif
19-
cd ./server && ./gradlew clean build
19+
cd ./server && ./gradlew clean build $(args)
2020
docker build -t ghcr.io/r-sandor/findfirst-server -f ./docker/server/Dockerfile.buildlocal ./server
2121

2222
build_screenshot:
23-
cd ./screenshot && ./gradlew clean build
23+
cd ./screenshot && ./gradlew clean build $(args)
2424
docker build -t ghcr.io/r-sandor/findfirst-screenshot -f ./docker/screenshot/Dockerfile.buildlocal ./screenshot
2525

2626
build_frontend:

docker-compose-prod.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ services:
2323
- SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
2424
- SCREENSHOT_SERVICE_URL=http://screenshot:8080/
2525
- FINDFIRST_SCREENSHOT_LOCATION=/app/screenshots
26+
- FINDFIRST_TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
27+
- FINDFIRST_TYPESENSE_HOST=${TYPESENSE_SERVICE_HOST}
2628
volumes:
2729
- ./server/prod.yml:/app/prod.yml
2830
- ./data/screenshots:/app/screenshots
2931
depends_on:
3032
- db
33+
- typesense
3134
restart: always
3235
screenshot:
3336
build:

docker-compose-staging.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

docker-compose.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ services:
1818
- SCREENSHOT_SERVICE_URL=${SCREENSHOT_SERVICE_URL}
1919
- FINDFIRST_SCREENSHOT_LOCATION=/app/screenshots
2020
- FINDFIRST_UPLOAD_LOCATION=/app/profile-pictures/
21+
- FINDFIRST_TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
22+
- FINDFIRST_TYPESENSE_HOST=${TYPESENSE_SERVICE_HOST}
2123
volumes:
2224
- ./data/screenshots:/app/screenshots
2325
- ./data/uploads/profile-pictures:/app/profile-pictures
26+
depends_on:
27+
- db
28+
- typesense
2429
screenshot:
2530
image: ghcr.io/r-sandor/findfirst-screenshot:latest
2631
ports:
27-
- "8080:8080"
32+
- 8080:8080
2833
environment:
2934
- SPRING_PROFILES_ACTIVE=dev
3035
- FINDFIRST_SCREENSHOT_LOCATION=/app/screenshots
@@ -34,7 +39,7 @@ services:
3439
image: typesense/typesense:27.1
3540
restart: on-failure
3641
ports:
37-
- "8108:8108"
42+
- 8108:8108
3843
environment:
3944
- TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
4045
volumes:

server/src/main/java/dev/findfirst/core/config/TypesenseConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
@Slf4j
1616
public class TypesenseConfiguration {
1717

18-
@Value("${typesense_api_key}")
18+
@Value("${findfirst.typesense.api_key}")
1919
String typesSenseApiKey;
2020

21+
@Value("${findfirst.typesense.host}")
22+
String host;
23+
2124
@Bean
2225
public Client typesenseClient() {
2326
List<Node> nodes = new ArrayList<>();
24-
nodes.add(new Node("http", // For Typesense Cloud use https
25-
"localhost", // For Typesense Cloud use xxx.a1.typesense.net
26-
"8108" // For Typesense Cloud use 443
27-
));
27+
nodes.add(new Node("http", host, "8108"));
2828
org.typesense.api.Configuration configuration =
2929
new org.typesense.api.Configuration(nodes, Duration.ofSeconds(9), typesSenseApiKey);
3030
return new Client(configuration);

server/src/main/java/dev/findfirst/core/controller/SearchController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import lombok.RequiredArgsConstructor;
1515
import lombok.extern.slf4j.Slf4j;
16-
1716
import org.springframework.http.HttpStatus;
1817
import org.springframework.http.ResponseEntity;
1918
import org.springframework.web.bind.annotation.GetMapping;

server/src/main/resources/application-prod.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ logging.level.org.springframework.jdbc=ERROR
44
# SQL Settings
55
spring.sql.init.mode=never
66

7-
87
# Postgres connect settings
98
spring.datasource.url=jdbc:postgresql://localhost:5432/findfirst
109
spring.datasource.driver-class-name=org.postgresql.Driver
11-
spring.datasource.username=postgres
12-
spring.datasource.password=admin
1310

1411

1512
spring.config.import=optional:file:/app/prod.yml

server/src/main/resources/application.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ findfirst.local.screenshot=../data/screenshots
2121
findfirst.screenshot.location=${FINDFIRST_SCREENSHOT_LOCATION:${findfirst.local.screenshot}}
2222
findfirst.app.frontend-url=${FINDFIRST_APP_FRONTEND-URL:http://localhost:3000/}
2323
findfirst.app.domain=localhost
24-
typesense_api_key=${TYPESENSE_API_KEY:xyz}
24+
findfirst.typesense.api_key=${TYPESENSE_API_KEY:xyz}
25+
findfirst.typesense.host=${FINDFIRST_TYPESENSE_HOST:localhost}
2526

2627
findfirst.upload.allowed-types=image/jpeg,image/png
2728
findfirst.local.upload.profile-pictures=../data/uploads/profile-pictures/

0 commit comments

Comments
 (0)