Skip to content

Commit

Permalink
Merge pull request #26 from polygloat/main
Browse files Browse the repository at this point in the history
Create release
  • Loading branch information
JanCizmar authored Dec 5, 2020
2 parents 5fe81b3 + c763558 commit 7f9fb0c
Show file tree
Hide file tree
Showing 111 changed files with 3,259 additions and 1,364 deletions.
2 changes: 1 addition & 1 deletion .buildversions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export WEBAPP_VERSION=v1.0.0-alpha.3
export WEBAPP_VERSION=v1.0.0-alpha.5
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
10 changes: 6 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ jobs:
VERSION: ${{ steps.version.outputs.VERSION }}

- name: Start docker stack
run: docker run -d --name app -e app.populate=true -e app.allowInternal=true -p8080:8080 polygloat/polygloat
run: docker run -d --name polygloat -e polygloat.internal.populate=true -e polygloat.internal.controller-enabled=true -p8080:8080 polygloat/polygloat

- name: Wait for running container
run: 'until docker logs --since 5m app | grep -m 1 "started on port(s): 8080"; do : ;done'
run: 'until docker logs --since 5m polygloat | grep -m 1 "started on port(s): 8080"; do : ;done'

- name: Run cypress tests
run: npm run cy:run
run: |
export CYPRESS_DEFAULT_PASSWORD=$(docker exec polygloat cat /data/initial.pwd)
npm run cy:run
working-directory: ./webapp
env:
CYPRESS_HOST: http://localhost:8080
Expand Down Expand Up @@ -87,7 +89,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/polygloat-${{ steps.version.outputs.VERSION }}.jar
asset_name: polygloat-${{ steps.version.outputs.VERSION }}.jar
asset_content_type: application/java-archive
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ jobs:
- run: WEBAPP_PATH=./webapp ./gradlew docker

- name: Start docker stack
run: docker run -d --name app -e app.populate=true -e app.allowInternal=true -p8080:8080 polygloat/polygloat
run: docker run -d --name polygloat -e polygloat.internal.populate=true -e polygloat.internal.controller-enabled=true -p8080:8080 polygloat/polygloat

- name: Wait for running container
run: 'until docker logs --since 5m app | grep -m 1 "started on port(s): 8080"; do : ;done'
run: 'until docker logs --since 5m polygloat | grep -m 1 "started on port(s): 8080"; do : ;done'

- name: Run cypress tests
run: npm run cy:run
run: |
export CYPRESS_DEFAULT_PASSWORD=$(docker exec polygloat cat /data/initial.pwd)
npm run cy:run
working-directory: ./webapp
env:
CYPRESS_HOST: http://localhost:8080
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ polygloatRestructure.server.iml
polygloatRestructure.server.main.iml
polygloatRestructure.server.test.iml
src/main/resources/application-dev.properties
src/main/resources/application-dev.yaml

bin
server.iml
trace.db
60 changes: 35 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.4.0")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20"
}
}

plugins {
id "com.palantir.docker" version "0.22.1"
id "com.palantir.docker" version "0.25.0"
id 'com.palantir.docker-compose' version "0.22.1"
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'org.springframework.boot' version '2.2.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'org.springframework.boot' version '2.4.0'
id 'java'
id 'org.liquibase.gradle' version '2.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
id "org.jetbrains.kotlin.plugin.jpa" version "1.4.20-RC"
//id "org.jetbrains.kotlin.kapt" version "1.4.10"
id "org.jetbrains.kotlin.kapt" version "1.4.20"
}

group = 'io.polygloat'
Expand Down Expand Up @@ -64,57 +64,67 @@ liquibase {
referenceUrl liveDb.referenceUrl
username liveDb.username
password liveDb.password
driver "org.postgresql.Driver"
}
}
}

def LIQUIBASE_VERSION = "3.6.3"
def LIQUIBASE_HIBERNATE_VERSION = "3.6"
diff.dependsOn compileKotlin
diffChangeLog.dependsOn compileKotlin

def LIQUIBASE_VERSION = "4.2.1"
def LIQUIBASE_HIBERNATE_VERSION = "4.1.1"
def JJWT_VERSION = "0.11.2"
def SPRING_DOC_VERSION = "1.5.0"

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation("org.springframework.boot:spring-boot-starter-security")
implementation 'io.sentry:sentry-spring:1.7.27'
implementation "org.springframework.boot:spring-boot-starter-validation"
kapt "org.springframework.boot:spring-boot-configuration-processor"
compile "org.springframework.boot:spring-boot-configuration-processor"
testCompile "org.springframework.boot:spring-boot-configuration-processor"
implementation 'io.sentry:sentry-spring-boot-starter:3.2.0'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'com.h2database:h2'
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testCompile("org.assertj:assertj-core:3.11.1")
testCompile("org.assertj:assertj-core:3.18.1")
testCompile("org.springframework.security:spring-security-test")
implementation("org.springframework.ldap:spring-ldap-core")
implementation("org.springframework.security:spring-security-ldap")
implementation("org.springframework:spring-tx")
implementation("com.unboundid:unboundid-ldapsdk")
implementation 'io.jsonwebtoken:jjwt-api:0.10.7'
runtime 'io.jsonwebtoken:jjwt-impl:0.10.7',
'io.jsonwebtoken:jjwt-jackson:0.10.7'
implementation "io.jsonwebtoken:jjwt-api:${JJWT_VERSION}"
runtime "io.jsonwebtoken:jjwt-impl:${JJWT_VERSION}",
"io.jsonwebtoken:jjwt-jackson:${JJWT_VERSION}"
implementation("org.liquibase:liquibase-core:$LIQUIBASE_VERSION")
runtime("org.liquibase:liquibase-core:$LIQUIBASE_VERSION")
compile("org.liquibase:liquibase-core:$LIQUIBASE_VERSION")
liquibaseRuntime("org.liquibase:liquibase-core:$LIQUIBASE_VERSION")
liquibaseRuntime 'org.postgresql:postgresql'
liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:2.0.1')
liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:3.0.0')
liquibaseRuntime("org.liquibase.ext:liquibase-hibernate5:$LIQUIBASE_HIBERNATE_VERSION")
liquibaseRuntime('org.springframework.boot:spring-boot-starter-data-jpa')
liquibaseRuntime sourceSets.main.output
implementation 'com.github.javafaker:javafaker:1.0.1'
implementation 'org.projectlombok:lombok:1.18.10'
testAnnotationProcessor "org.projectlombok:lombok:1.18.6"
implementation 'org.projectlombok:lombok:1.18.16'
testAnnotationProcessor "org.projectlombok:lombok:1.18.16"
annotationProcessor 'org.projectlombok:lombok:1.18.10'
implementation 'org.hibernate:hibernate-jpamodelgen'
annotationProcessor('org.hibernate:hibernate-jpamodelgen')
testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
implementation 'org.springdoc:springdoc-openapi-webmvc-core:1.3.4'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.3.4'
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.4.1'
//kapt "org.hibernate:hibernate-jpamodelgen"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.10'
testCompile group: 'org.testng', name: 'testng', version: '7.3.0'
implementation "org.springdoc:springdoc-openapi-webmvc-core:${SPRING_DOC_VERSION}"
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: "${SPRING_DOC_VERSION}"
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.4.2-native-mt'
kapt "org.hibernate:hibernate-jpamodelgen"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.20'
liquibaseRuntime group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.10'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.11.3'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.0'
}

test {
Expand All @@ -141,7 +151,7 @@ sourceSets {
test.kotlin.srcDirs = ['src/test/kotlin', 'src/test/java']
}

def customWebApp = System.getenv().containsKey("WEBAPP_PATH");
def customWebApp = System.getenv().containsKey("WEBAPP_PATH")
def webappPath = customWebApp ? System.getenv().get("WEBAPP_PATH") : rootProject.project("webapp").projectDir

task unpack(type: Copy) {
Expand Down
8 changes: 7 additions & 1 deletion docker.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ docker {
dockerfile file('docker/app/Dockerfile')
name "polygloat/polygloat"
copySpec.from(tasks.unpack.outputs, 'docker/app').into("dependency")
//copySpec.from('docker/app/.dockerignore').into(".")
buildArgs(['DEPENDENCY': "dependency"])
}

Expand All @@ -10,4 +11,9 @@ if (tasks.findByName("wrapper") == null) {
}
}

project.tasks.findByName("docker").dependsOn(unpack, copyDist)
task copyDockerIgnore(type: Copy) {
from "docker/app/.dockerignore"
into "build/docker"
}

project.tasks.findByName("docker").dependsOn(unpack, copyDist, copyDockerIgnore)
59 changes: 1 addition & 58 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,4 @@ exposePort=8091
########## DB ##############
spring.datasource.url=jdbc:postgresql://db:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres

########## JWT #############
#app.jwtExpirationInMs=604800000
#app.jwtSecret=

########## AUTHENTICATION
polygloat.authentication=true

########## NATIVE
polygloat.auth.native=true
polygloat.auth.allow-registrations=false

########## github oauth server
#polygloat.security.github.client-secret=
#polygloat.security.github.client-id=
polygloat.security.github.authorization-link=https://github.com/login/oauth/access_token
polygloat.security.github.user-link=https://api.github.com/user

######### SMTP ###########
polygloat.mail.host=smtp
polygloat.spring.mail.username=
polygloat.mail.password=
polygloat.mail.properties.mail.smtp.port=25
polygloat.mail.properties.mail.smtp.auth=false
polygloat.mail.properties.mail.smtp.ssl.enable=false
polygloat.mail.from=no-reply@polygloat.io

######### SENTRY
sentry.enabled=true
sentry.dsn=https://d4b8a7c884564913a24138c701217ef5@sentry.io/1853051

########## DEBUG
#logging.level.org.springframework.security=DEBUG
#logging.level.org.hibernate.SQL=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
#logging.level.org.springframework.web=DEBUG
#logging.level.org.hibernate=ERROR
#logging.level.root=DEBUG

########## INITIAL USER
app.initialUsername=admin
app.initialPassword=admin

######### EMBEDDED LDAP TESTING SERVER
#spring.ldap.embedded.ldif=classpath:test-server.ldif
#spring.ldap.embedded.base-dn=dc=springframework,dc=org
#spring.ldap.embedded.credential.username=uid=admin
#spring.ldap.embedded.credential.password=secret
#spring.ldap.embedded.port=8389

######### EMBEDDED WEB SERVER
# Enable response compression
server.compression.enabled=true
# The comma-separated list of mime types that should be compressed
server.compression.mime-types=text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
# Compress the response only if the response size is at least 1KB
server.compression.min-response-size=1024
spring.datasource.password=postgres
1 change: 1 addition & 0 deletions docker/app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/application-*.yaml
7 changes: 2 additions & 5 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM openjdk:14-jdk-alpine
VOLUME /tmp

ARG DEPENDENCY=target/dependency
ARG PROPERTIES=application.properties
ARG PROPERTIES=application.yaml

EXPOSE 8080

Expand All @@ -11,9 +11,6 @@ VOLUME /db
COPY ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app
COPY ${DEPENDENCY}/${PROPERTIES} /app/application.properties

#remove all profile properties
RUN rm -f /app/application-*.properties
COPY ${DEPENDENCY}/${PROPERTIES} /app/application.yaml

ENTRYPOINT ["java","-cp","app:app/lib/*","io.polygloat.Application"]
18 changes: 0 additions & 18 deletions docker/app/application.properties

This file was deleted.

16 changes: 16 additions & 0 deletions docker/app/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
polygloat:
data-path: /data

spring:
datasource:
url: jdbc:h2:${polygloat.data-path}/db.h2
username: sa
password: password
liquibase:
change-log: classpath:db/changelog/schema.xml

server:
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
min-response-size: 1024
41 changes: 0 additions & 41 deletions src/main/java/io/polygloat/Application.java

This file was deleted.

Loading

0 comments on commit 7f9fb0c

Please sign in to comment.