Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.volumes/
target/
.volumes/
.git
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,19 @@ existem dois scripts `bash` que podem ser usados para criação de arquivos de m

| **Descrição** | **parâmetro** | **Valor padrão** |
| ------------------------------------------- | -------------------------------------- | ------------------------- |
| contexto da aplicação | `contexto` | api/ |
| porta da aplicação | `port` | 8080 |
| url do banco | `db-url` | localhost:3306/common_app |
| nome de usuário (banco) | `db-username` | root |
| senha do usuário (banco) | `db-password` | root |
| mostrar sql na saida | `show-sql` | false |
| valor do secret na geração dos tokens | `token-secret` | secret |
| tempo de expiração do token em horas | `token-expiration-time-in-hours` | 24 |
| tempo de expiração do refresh token em dias | `refresh-token-expiration-time-in-day` | 7 |
| máximo de conexões com o banco | `max-connections` | 5 |
| endereço do servidor smtp | `smtp-host` | smtp.gmail.com |
| porta do servidor smtp | `smtp-port` | 587 |
| nome de usuário smtp | `smtp-username` | user |
| senha do servidor smtp | `smtp-password` | secret |
| porta da aplicação | `SERVER_PORT` | 8080 |
| url do banco | `DB_URL` | localhost:3306/common_app |
| nome de usuário (banco) | `DB_USERNAME` | root |
| senha do usuário (banco) | `DB_PASSWORD` | root |
| mostrar sql na saida | `DB_SHOW_SQL` | false |
| máximo de conexões com o banco | `DB_MAX_CONNECTIONS` | 5 |
| valor do secret na geração dos tokens | `TOKEN_SECRET` | secret |
| tempo de expiração do token em horas | `TOKEN_EXPIRATION_IN_HOURS` | 24 |
| tempo de expiração do refresh token em dias | `REFRESH_TOKEN_EXPIRATION_IN_DAYS` | 7 |
| endereço do servidor smtp | `SMTP_HOST` | smtp.gmail.com |
| porta do servidor smtp | `SMTP_PORT` | 587 |
| nome de usuário smtp | `SMTP_USERNAME` | user |
| senha do servidor smtp | `SMTP_PASSWORD` | secret |

> são definidas em: [**application.properties**](./src/main/resources/application.properties)
>
Expand Down
19 changes: 17 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ services:

mariadb:
image: mariadb:10.6.1
network_mode: host
restart: always
container_name: mariadb-container
ports:
- 3306:3306
environment:
Expand All @@ -13,3 +12,19 @@ services:
volumes:
- ./.volumes/database:/var/lib/mysql

api:
build: ./
links:
- mariadb
depends_on:
- mariadb
ports:
- 8080:8080
- 8000:8000
environment:
DB_URL: "mariadb:3306/common_app"
DB_USERNAME: "root"
DB_PASSWORD: "root"
volumes:
- ./:/app
- ./.volumes/maven:/root/.m2
5 changes: 5 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM maven:3.8.3

WORKDIR /app

ENTRYPOINT ["mvn", "spring-boot:run"]
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-agentlib:jdwp=transport=dt_socket,server=y,address=*:8000,suspend=n
</jvmArguments>
</configuration>
<executions>
<execution>
<goals>
Expand Down
29 changes: 14 additions & 15 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# Mais configuracoes: https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

# Porta do sistema.
server.port=${port:8080}
server.port=${SERVER_PORT:8080}

# logger
logging.level.springfox.documentation=off
logging.level.org.springframework.web=trace
spring.output.ansi.enabled=always
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=${show-sql:true}
spring.jpa.show-sql=${DB_SHOW_SQL:true}

# Banco de dados
spring.datasource.hikari.maximum-pool-size=${max-connections:5}
spring.datasource.url=jdbc:mysql://${db-url:localhost:3306/common_app}?useSSL=false&createDatabaseIfNotExist=true&serverTimezone=America/Sao_Paulo
spring.datasource.username=${db-username:root}
spring.datasource.password=${db-password:root}
spring.datasource.hikari.maximum-pool-size=${DB_MAX_CONNECTIONS:5}
spring.datasource.url=jdbc:mysql://${DB_URL:localhost:3306/common_app}?useSSL=false&createDatabaseIfNotExist=true&serverTimezone=America/Sao_Paulo
spring.datasource.username=${DB_USERNAME:root}
spring.datasource.password=${DB_PASSWORD:root}
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.properties.javax.persistence.validation.mode=none
Expand All @@ -27,15 +27,15 @@ springfox.documentation.swagger-ui.base-url=/documentation
springfox.documentation.swagger.v2.use-model-v3=false

# token
token.expiration-in-hours=${token-expiration-time-in-hours:24}
token.refresh.expiration-in-days=${refresh-token-expiration-time-in-days:7}
token.secret=${token-secret:secret}
token.expiration-in-hours=${TOKEN_EXPIRATION_IN_HOURS:24}
token.refresh.expiration-in-days=${REFRESH_TOKEN_EXPIRATION_IN_DAYS:7}
token.secret=${TOKEN_SECRET:secret}

# smtp configurations
spring.mail.host=${smtp-host:smtp.gmail.com}
spring.mail.port=${smtp-port:587}
spring.mail.username=${smtp-username:user}
spring.mail.password=${smtp-password:secret}
spring.mail.host=${SMTP_HOST:smtp.gmail.com}
spring.mail.port=${SMTP_PORT:587}
spring.mail.username=${SMTP_USERNAME:user}
spring.mail.password=${SMTP_PASSWORD:secret}

spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
Expand All @@ -44,5 +44,4 @@ spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.properties.mail.smtp.starttls.enable=true

# templates
spring.resources.cache.period=0

spring.resources.cache.period=0