Skip to content

Commit

Permalink
simplfy environments parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpochat committed Jul 25, 2021
1 parent 5415761 commit b0cd115
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 77 deletions.
6 changes: 4 additions & 2 deletions core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ WORKDIR /home/localeat

COPY ./core ./core

RUN mvn clean install -s /usr/share/maven/ref/settings-docker.xml -f ./core/pom.xml
RUN mvn -s /usr/share/maven/ref/settings-docker.xml -f ./core/pom.xml dependency:go-offline
RUN mvn install -s /usr/share/maven/ref/settings-docker.xml -f ./core/pom.xml
RUN mvn exec:java -s /usr/share/maven/ref/settings-docker.xml -f ./core/pom.xml -Dexec.skip=true

USER localeat

ENV spring_profiles_active=database-postgre

# Wait for Postgre database (localhost:5432)
# and then start java core application
ENTRYPOINT ["wait-for-it", \
Expand All @@ -29,7 +32,6 @@ ENTRYPOINT ["wait-for-it", \
"/usr/share/maven/ref/settings-docker.xml", \
"-f", \
"./core/pom.xml", \
"-Dspring.profiles.active=prod", \
"-Ddatasource_url=${localeat_datasource_url}", \
"-Ddatasource_username=${localeat_datasource_username}", \
"-Ddatasource_password=${localeat_datasource_password}", \
Expand Down
5 changes: 5 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-version}</version>
<configuration>
<environmentVariables>
<spring.jpa.properties.hibernate.dialect>org.hibernate.dialect.H2Dialect</spring.jpa.properties.hibernate.dialect>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down
6 changes: 1 addition & 5 deletions core/src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ spring.datasource.url = jdbc:postgresql://localhost:5432/localeat
spring.datasource.username = localeat
spring.datasource.password = localeat

# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgresPlusDialect
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

logging.level.org.springframework.web = DEBUG
logging.level.com.localeat = DEBUG

#localeat.http.domainname = localhost
localeat.http.domainname = staging.viandeendirect.eu

localeat.payment.molliepaymentapikey = test_Wqwg9z7fDfCd9tRJQKfwQCh6TMrxfy
3 changes: 0 additions & 3 deletions core/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
# Workaround to make the service "GET /product/{product}/photo" return a non nul photo content
# see https://github.com/benjaminpochat/localeat/issues/27
logging.level.org.springframework.web = WARN
logging.level.com.localeat = WARN

# SPRING
#-------
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
# /!\ Caution : The datasource is not set by SpringBoot default initialization
# The datasource is set in CommandLineDatabaseConfig
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto = update

# LOCALEAT
Expand Down

This file was deleted.

39 changes: 0 additions & 39 deletions docker-compose-build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
version: '3.7'
services:

database:
image: postgres:12.2-alpine
networks:
- hostnet
environment:
- POSTGRES_USER=localeat
- POSTGRES_PASSWORD=localeat
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- /var/lib/postgresql/data/pgdata:/var/lib/postgresql/data/pgdata
ports:
- 5432:5432

core:
build:
context: "."
dockerfile: ./core/Dockerfile
image: benjaminpochat/localeat-core:${DOCKER_IMAGE_TAG:-latest}
networks:
- hostnet
depends_on:
- database
environment:
- localeat_datasource_url=jdbc:postgresql://localhost:5432/localeat
- localeat_datasource_username=localeat
- localeat_datasource_password=localeat
- [email protected]
- localeat_smtp_password=localeat
- localeat_http_domainname=http://localhost:4200
ports:
- 8080:8080

ui:
build:
Expand All @@ -40,16 +14,3 @@ services:
args:
- localeat_environment_type=production
image: benjaminpochat/localeat-ui:${DOCKER_IMAGE_TAG:-latest}
networks:
- hostnet
depends_on:
- core
volumes:
- /home/benjamin/Documents/workspace/localeat/test/localeat-ui-config:/usr/local/apache2/htdocs/assets/config
ports:
- 80:80

networks:
hostnet:
external: true
name: host
8 changes: 5 additions & 3 deletions docker-compose-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ services:
depends_on:
- database
environment:
- localeat_datasource_url=jdbc:postgresql://database:5432/localeat
- localeat_datasource_username=localeat
- localeat_datasource_password=<password>
- spring_datasource_url=jdbc:postgresql://database:5432/localeat
- spring_datasource_username=localeat
- spring_datasource_password=<password>
- spring_jpa_properties_hibernate_dialect=org.hibernate.dialect.PostgresPlusDialect
- [email protected]
- localeat_smtp_password=localeat
- localeat_http_domainname=<domain_name_for_localeat_server>
- localeat.payment.molliepaymentapikey=<mollie_api_key>
ports:
- <published_backend_port>:8080

Expand Down

0 comments on commit b0cd115

Please sign in to comment.