Skip to content

Commit

Permalink
changed how local development should work
Browse files Browse the repository at this point in the history
  • Loading branch information
mehedikhan72 committed Aug 25, 2024
1 parent 876ba59 commit 8df39ca
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 60 deletions.
16 changes: 16 additions & 0 deletions .env.prototype
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Database config - Replace if needed

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=pathfinder
SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/pathfinder
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=postgres

SPRING_PROFILES_ACTIVE=dev

# Recombee(Recommendation service provider) config - secrets available to maintainers only.
# Contact us to get access.

RECOMBEE_PRIVATE_TOKEN = "replace_me"
RECOMBEE_DATABASE_ID = "replace_me"
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,5 @@ jobs:
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
-e DB_NAME=${{ secrets.DB_NAME }} \
-e DB_PORT=${{ secrets.DB_PORT }} \
-e SPRING_PROFILES_ACTIVE=prod \
$(echo $REGISTRY)/$(echo $IMAGE_NAME):$(echo $GITHUB_SHA | head -c7)
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
.env.development
.env.secrets
.env
.env.production

### STS ###
.apt_generated
Expand Down
36 changes: 0 additions & 36 deletions docker-compose.yml

This file was deleted.

48 changes: 29 additions & 19 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
# Common configurations (shared between all profiles)
spring:
datasource:
# local dev without docker.
# url: jdbc:postgresql://localhost:5432/pathfinder
# username: postgres
# password: postgres

# docker-compose
# url: ${SPRING_DATASOURCE_URL}
# username: ${SPRING_DATASOURCE_USERNAME}
# password: ${SPRING_DATASOURCE_PASSWORD}

# digitalocean prod env
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=require
username: ${DB_USERNAME}
password: ${DB_PASSWORD}

driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: update

show-sql: true
properties:
hibernate:
Expand All @@ -46,6 +29,33 @@ logging:
web: DEBUG
hibernate: ERROR

# Profile-specific configurations
---
# Development profile
spring:
config:
activate:
on-profile: dev
datasource:
url: jdbc:postgresql://localhost:5432/pathfinder
username: postgres
password: postgres

recombee:
private-token: ${RECOMBEE_PRIVATE_TOKEN}
database-id: ${RECOMBEE_DATABASE_ID}
database-id: ${RECOMBEE_DATABASE_ID}

---
# Production profile
spring:
config:
activate:
on-profile: prod
datasource:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=require
username: ${DB_USERNAME}
password: ${DB_PASSWORD}

recombee:
private-token: "todo"
database-id: "todo"
6 changes: 3 additions & 3 deletions start-dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rm .env
cp .env.development .env
#docker-compose down
docker-compose up --build
cp .env.prototype .env

mvn -e spring-boot:run -DskipTests -Dcheckstyle.skip=true -Dspring-boot.run.profiles=dev

0 comments on commit 8df39ca

Please sign in to comment.