Prepare deployment
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Armin Friedl 2020-06-11 22:00:20 +02:00
parent adf8f4e08d
commit c9fa0c023e
Signed by: armin
GPG key ID: 48C726EEE7FBCBC8
12 changed files with 111 additions and 8 deletions

View file

@ -4,11 +4,10 @@ name: default
steps: steps:
- name: build-service - name: build-service
image: adoptopenjdk:11-hotspot image: maven:3.6-jdk-11
commands: commands:
- ls -al
- cd service/fling - cd service/fling
- ./mvnw -Plocal clean package - mvn clean package
- name: build-web - name: build-web
image: node:latest image: node:latest
@ -16,3 +15,14 @@ steps:
- ls -al - ls -al
- cd web/fling - cd web/fling
- npm install && CI=false npm run build - npm install && CI=false npm run build
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: container/Dockerfile
repo: arminfriedl/fling
tags: dev

3
.gitignore vendored
View file

@ -370,8 +370,7 @@ typings/
.yarn-integrity .yarn-integrity
# dotenv environment variables file # dotenv environment variables file
.env .env*local
.env.test
# parcel-bundler cache (https://parceljs.org/) # parcel-bundler cache (https://parceljs.org/)
.cache .cache

13
container/Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM debian:stable
RUN ls -al
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y nginx openjdk-11-jre && \
mkdir -p /var/www/fling && \
mv web/fling/build/* /var/www/fling/ && \
rm -fr web \
COPY ./etc/nginx/conf.d /etc/nginx/conf.d
ENTRYPOINT ["/bin/sh"]

View file

@ -0,0 +1,43 @@
server {
listen 3000;
listen [::]:3000;
server_name _;
root /var/html/fling;
# config to enable HSTS(HTTP Strict Transport Security)
add_header Strict-Transport-Security "max-age=15552000; includeSubdomains;";
# forward /api requests to tomcat
location /api {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
# Required for web sockets to function
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Allow huge file uploads
client_max_body_size 5G;
}
# always respond with index.html for unknown paths
# (routing is client side)
location / {
try_files $uri /index.html;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

View file

View file

5
service/Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM adoptopenjdk:11-hotspot
COPY fling fling
ENTRYPOINT /bin/sh

View file

@ -21,8 +21,6 @@
<bouncycastle.version>1.64</bouncycastle.version> <bouncycastle.version>1.64</bouncycastle.version>
<jwt.version>0.11.1</jwt.version> <jwt.version>0.11.1</jwt.version>
<spring.version>${project.parent.version}</spring.version> <spring.version>${project.parent.version}</spring.version>
<!-- automatically run annotation processors within the incremental compilation -->
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties> </properties>
<dependencies> <dependencies>
@ -148,6 +146,8 @@
<id>local</id> <id>local</id>
<properties> <properties>
<spring.profiles.active>local</spring.profiles.active> <spring.profiles.active>local</spring.profiles.active>
<!-- automatically run annotation processors within the incremental compilation -->
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>

View file

@ -0,0 +1,26 @@
spring:
datasource:
url: jdbc:h2:mem:testdb;
driverClassName: org.h2.Driver
username: sa
password:
jpa:
hibernate.ddl-auto: update
database-platform: org.hibernate.dialect.H2Dialect
servlet:
multipart.max-file-size: -1
multipart.max-request-size: -1
logging.level:
root: WARN
fling:
archive.fileystem.directory: "/var/fling/files"
security:
allowed-origins:
- "https://friedl.net"
- "http://localhost:3000"
admin-user: "${FLING_ADMIN_USER:admin}"
admin-password: "${FLING_ADMIN_PASSWORD:123}"
signing-key: "${FLING_SIGNING_KEY:changeitchangeitchangeitchangeit}"
jwt-expiration: "${FLING_JWT_EXPIRATION:180000}"

5
web/Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM node:latest
COPY fling fling
ENTRYPOINT /bin/sh

2
web/fling/.env Normal file
View file

@ -0,0 +1,2 @@
REACT_APP_API=https://fling.friedl.net/api
REACT_APP_LOGLEVEL=warn