-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from nokia-wroclaw/travis_heroku
Travis heroku
- Loading branch information
Showing
9 changed files
with
133 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,13 @@ services: | |
depends_on: | ||
- db # This service depends on mysql. Start that first. | ||
environment: # Pass environment variables to the service | ||
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/db3s | ||
#SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/db3s | ||
#?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false | ||
SPRING_DATASOURCE_USERNAME: root | ||
SPRING_DATASOURCE_PASSWORD: 1q2w3e4r | ||
#SPRING_DATASOURCE_USERNAME: root | ||
#SPRING_DATASOURCE_PASSWORD: 1q2w3e4r | ||
SPRING_DATASOURCE_URL: jdbc:mysql://b8e819c239af2b:[email protected]/heroku_7013a700c5d03a4?reconnect=true | ||
SPRING_DATASOURCE_USERNAME: b8e819c239af2b | ||
SPRING_DATASOURCE_PASSWORD: ce5382cc | ||
|
||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:12.2.0 as build-node | ||
WORKDIR /front | ||
COPY . . | ||
RUN npm install | ||
RUN npm run build --prod | ||
RUN npm install express | ||
FROM nginx:1.15 | ||
COPY default.conf /etc/nginx/conf.d/default.conf | ||
WORKDIR /usr/share/nginx/html | ||
COPY dist/front . | ||
CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
server { | ||
listen 4200; | ||
listen $PORT; | ||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM maven:3.5.2-jdk-8-alpine AS MAVEN_BUILD | ||
|
||
WORKDIR /server | ||
COPY . . | ||
RUN mvn -Dmaven.test.skip=true package | ||
|
||
FROM openjdk:8-jdk-alpine | ||
|
||
WORKDIR /server | ||
#.jar file name depends on pom.xml project.build.finalName property, eg. <finalName>SpringApp</finalName> | ||
COPY --from=MAVEN_BUILD /server/target/server-0.0.1-SNAPSHOT.jar ./ | ||
|
||
RUN apk update && apk add docker | ||
CMD java -Xms256m -Xmx400m -jar ./server-0.0.1-SNAPSHOT.jar | ||
EXPOSE 8080:8080 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
|
||
|
||
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) | ||
spring.datasource.url = jdbc:mysql://localhost:3306/db3s | ||
|
||
|
||
#spring.datasource.url = jdbc:mysql://localhost:3306/db3s | ||
#?useSSL=false | ||
spring.datasource.username = root | ||
spring.datasource.password = 1q2w3e4r | ||
#spring.datasource.username = root | ||
#spring.datasource.password = 1q2w3e4r | ||
|
||
spring.datasource.url = jdbc:mysql://b8e819c239af2b:[email protected]/heroku_7013a700c5d03a4?reconnect=true | ||
spring.datasource.username = b8e819c239af2b | ||
spring.datasource.password = ce5382cc | ||
|
||
spring.datasource.hikari.connectionTimeout=30000 | ||
spring.datasource.hikari.idleTimeout=600000 | ||
spring.datasource.hikari.maxLifetime=27000000 | ||
|
||
spring.session.jdbc.initialize-schema: always | ||
|
||
|
||
## Hibernate Properties | ||
# The SQL dialect makes Hibernate generate better SQL for the chosen database | ||
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
language: java | ||
jdk: | ||
- openjdk8 | ||
install: true | ||
env: | ||
-HEROKU_API_KEY=$HEROKU_TOKEN | ||
-TAG=test | ||
services: | ||
- docker | ||
before_install: | ||
- npm install -g @angular/cli | ||
stages: | ||
- name: test | ||
- name: build | ||
- name: deploy | ||
jobs: | ||
include: | ||
- stage: test | ||
script: | ||
- cd server | ||
- chmod +x mvnw | ||
#- mvn test | ||
- cd .. | ||
- echo "test stage works" | ||
- stage: build | ||
script: | ||
- cd front | ||
- npm install | ||
- npm install express | ||
- ng build --prod | ||
- cd .. | ||
- cd server | ||
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V | ||
- echo "build stage works" | ||
- stage: deploy | ||
script: | ||
- curl https://cli-assets.heroku.com/install-standalone.sh | sh | ||
- docker login --username=_ --password=$HEROKU_TOKEN registry.heroku.com | ||
- cd server | ||
- mvn package -DskipTests=true | ||
- docker build -t registry.heroku.com/nokia3s-server/web -f Dockerfile.prod . | ||
- cd .. | ||
- cd front | ||
- npm install | ||
- npm install express | ||
- ng build --prod | ||
- docker build -t registry.heroku.com/nokia3s-front/web -f Dockerfile.prod . | ||
- docker push registry.heroku.com/nokia3s-server/web | ||
- docker push registry.heroku.com/nokia3s-front/web | ||
- /usr/local/bin/heroku container:release web -a nokia3s-server | ||
- /usr/local/bin/heroku container:release web -a nokia3s-front | ||
- echo "deploy stage works" | ||
cache: | ||
directories: | ||
- $HOME/.m2 |