Deploy ..
This commit is contained in:
parent
67915246ba
commit
8f9dc0d9ce
@ -1,6 +1,9 @@
|
|||||||
MYSQL_ROOT_PASSWORD=
|
MYSQL_ROOT_PASSWORD=
|
||||||
|
MYSQL_HOST=db
|
||||||
MYSQL_DATABASE=
|
MYSQL_DATABASE=
|
||||||
MYSQL_USER=
|
MYSQL_USER=
|
||||||
MYSQL_PASSWORD=
|
MYSQL_PASSWORD=
|
||||||
JWT_SECRET=
|
JWT_SECRET=
|
||||||
CORS=false
|
JWT_REFRESH_SECRET=
|
||||||
|
CORS=false
|
||||||
|
PORT=8081
|
||||||
|
|||||||
86
Caddyfile
86
Caddyfile
@ -4,7 +4,7 @@
|
|||||||
-Date
|
-Date
|
||||||
|
|
||||||
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||||
Feature-Policy "geolocation none;midi none;notifications none;push none;sync-xhr none;microphone none;camera none;magnetometer none;gyroscope none;speaker self;vibrate none;fullscreen self;payment none;"
|
Feature-Policy "geolocation none; midi none; notifications none; push none; sync-xhr none; microphone none; camera none; magnetometer none; gyroscope none; speaker self; vibrate none; fullscreen self; payment none"
|
||||||
X-Content-Type-Options "nosniff"
|
X-Content-Type-Options "nosniff"
|
||||||
X-Frame-Options "DENY"
|
X-Frame-Options "DENY"
|
||||||
X-XSS-Protection "1; mode=block"
|
X-XSS-Protection "1; mode=block"
|
||||||
@ -12,45 +12,56 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
simplenotes.be {
|
(common) {
|
||||||
@static {
|
@ignore {
|
||||||
path *.css *.js
|
path *.php
|
||||||
file
|
}
|
||||||
|
respond @ignore "no" 404
|
||||||
|
|
||||||
|
encode gzip
|
||||||
|
}
|
||||||
|
|
||||||
|
(nuxt) {
|
||||||
|
@nuxt {
|
||||||
|
path /_nuxt/*
|
||||||
}
|
}
|
||||||
|
|
||||||
@fonts {
|
header @nuxt Cache-Control "public, max-age=31536000" # 1 year
|
||||||
path *.woff *.woff2
|
}
|
||||||
file
|
|
||||||
}
|
simplenotes.be {
|
||||||
|
import security
|
||||||
|
import nuxt
|
||||||
|
import common
|
||||||
|
|
||||||
@404 {
|
@404 {
|
||||||
expression {http.error.status_code} == 404
|
expression {http.error.status_code} == 404
|
||||||
}
|
}
|
||||||
|
|
||||||
route /* {
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_errors {
|
handle_errors {
|
||||||
rewrite @404 /404.html
|
rewrite @404 /404.html
|
||||||
file_server
|
file_server
|
||||||
import security
|
import security
|
||||||
}
|
}
|
||||||
|
|
||||||
route /api/* {
|
route /* {
|
||||||
uri strip_prefix /api
|
file_server
|
||||||
reverse_proxy http://api:8081
|
}
|
||||||
|
|
||||||
|
route /api/* {
|
||||||
|
uri strip_prefix /api
|
||||||
|
reverse_proxy http://localhost:8081
|
||||||
}
|
}
|
||||||
|
|
||||||
header @static Cache-Control "public, max-age=31536000" # 1 year
|
|
||||||
header @fonts Cache-Control "public, max-age=604800" # 7 days
|
|
||||||
header Content-Security-Policy "default-src 'self' 'unsafe-inline';"
|
header Content-Security-Policy "default-src 'self' 'unsafe-inline';"
|
||||||
|
|
||||||
encode gzip
|
root * /var/www/simplenotes.be
|
||||||
root * /site
|
|
||||||
log
|
log {
|
||||||
|
output file /var/log/www/simplenotes.be.json
|
||||||
|
format json
|
||||||
|
}
|
||||||
|
|
||||||
import security
|
|
||||||
}
|
}
|
||||||
|
|
||||||
www.simplenotes.be {
|
www.simplenotes.be {
|
||||||
@ -58,9 +69,36 @@ www.simplenotes.be {
|
|||||||
}
|
}
|
||||||
|
|
||||||
docs.simplenotes.be {
|
docs.simplenotes.be {
|
||||||
file_server
|
|
||||||
root * /docs
|
|
||||||
import security
|
import security
|
||||||
|
import common
|
||||||
|
|
||||||
|
file_server
|
||||||
|
|
||||||
|
root * /var/www/docs.simplenotes.be
|
||||||
|
|
||||||
|
log {
|
||||||
|
output file /var/log/www/docs.simplenotes.be.json
|
||||||
|
format json
|
||||||
|
}
|
||||||
|
|
||||||
header Content-Security-Policy "default-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;"
|
header Content-Security-Policy "default-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
portfolio.simplenotes.be {
|
||||||
|
import security
|
||||||
|
import common
|
||||||
|
import nuxt
|
||||||
|
|
||||||
|
file_server
|
||||||
|
root * /var/www/portfolio.simplenotes.be
|
||||||
|
|
||||||
|
log {
|
||||||
|
output file /var/log/www/portfolio.simplenotes.be.json
|
||||||
|
format json
|
||||||
|
}
|
||||||
|
|
||||||
|
header @static Cache-Control "public, max-age=31536000" # 1 year
|
||||||
|
|
||||||
|
# header Content-Security-Policy "default-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net;"
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ COPY api/resources resources
|
|||||||
COPY api/src src
|
COPY api/src src
|
||||||
COPY api/test test
|
COPY api/test test
|
||||||
|
|
||||||
RUN mvn package
|
RUN mvn package -DskipTests
|
||||||
|
|
||||||
FROM openjdk:14-alpine
|
FROM openjdk:14-alpine
|
||||||
|
|
||||||
@ -25,4 +25,4 @@ USER $APPLICATION_USER
|
|||||||
COPY --from=builder /tmp/target/api-*-jar-with-dependencies.jar /app/notes-api.jar
|
COPY --from=builder /tmp/target/api-*-jar-with-dependencies.jar /app/notes-api.jar
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:InitialRAMFraction=2", "-XX:MinRAMFraction=2", "-XX:MaxRAMFraction=2", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "notes-api.jar"]
|
CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:InitialRAMFraction=2", "-XX:MinRAMFraction=2", "-XX:MaxRAMFraction=2", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "notes-api.jar"]
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
## Docker multi-stage build
|
|
||||||
|
|
||||||
## Generate api documentation
|
|
||||||
FROM quay.io/bukalapak/snowboard AS docbuilder
|
|
||||||
RUN mkdir /out
|
|
||||||
COPY api-doc /doc
|
|
||||||
RUN /app/packages/snowboard/bin/run html api.apib -o /out
|
|
||||||
|
|
||||||
## Generate website
|
|
||||||
FROM node:latest AS builder
|
|
||||||
COPY frontend /app
|
|
||||||
WORKDIR /app
|
|
||||||
RUN yarn install && yarn run generate
|
|
||||||
|
|
||||||
## Main image
|
|
||||||
FROM caddy:2.0.0
|
|
||||||
COPY Caddyfile /etc/caddy/Caddyfile
|
|
||||||
COPY --from=docbuilder /out /docs
|
|
||||||
COPY --from=builder /app/dist /site
|
|
||||||
@ -7,7 +7,7 @@ database:
|
|||||||
|
|
||||||
server:
|
server:
|
||||||
host: 0.0.0.0
|
host: 0.0.0.0
|
||||||
port: 8081
|
port: ${PORT:-8081}
|
||||||
cors: ${CORS:-true}
|
cors: ${CORS:-true}
|
||||||
|
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
@ -6,23 +6,23 @@ import be.vandewalleh.migrations.Migration
|
|||||||
import be.vandewalleh.routing.noteRoutes
|
import be.vandewalleh.routing.noteRoutes
|
||||||
import be.vandewalleh.routing.tagsRoute
|
import be.vandewalleh.routing.tagsRoute
|
||||||
import be.vandewalleh.routing.userRoutes
|
import be.vandewalleh.routing.userRoutes
|
||||||
import com.sksamuel.hoplite.fp.valid
|
|
||||||
import io.ktor.application.*
|
import io.ktor.application.*
|
||||||
import io.ktor.auth.*
|
import io.ktor.auth.*
|
||||||
import io.ktor.routing.*
|
import io.ktor.routing.*
|
||||||
import io.ktor.server.engine.*
|
import io.ktor.server.engine.*
|
||||||
import io.ktor.server.netty.*
|
import io.ktor.server.netty.*
|
||||||
import me.liuwj.ktorm.database.*
|
|
||||||
import org.kodein.di.Kodein
|
import org.kodein.di.Kodein
|
||||||
import org.kodein.di.description
|
import org.kodein.di.description
|
||||||
import org.kodein.di.generic.instance
|
import org.kodein.di.generic.instance
|
||||||
|
import org.kodein.di.generic.with
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
|
|
||||||
|
|
||||||
fun main() {
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
val kodein = Kodein{
|
val kodein = Kodein{
|
||||||
import(mainModule)
|
import(mainModule)
|
||||||
|
constant("config file") with "/application.prod.yaml" // FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
val config by kodein.instance<Config>()
|
val config by kodein.instance<Config>()
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import org.kodein.di.Kodein
|
|||||||
import org.kodein.di.generic.bind
|
import org.kodein.di.generic.bind
|
||||||
import org.kodein.di.generic.instance
|
import org.kodein.di.generic.instance
|
||||||
import org.kodein.di.generic.singleton
|
import org.kodein.di.generic.singleton
|
||||||
import org.kodein.di.generic.with
|
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import javax.sql.DataSource
|
import javax.sql.DataSource
|
||||||
|
|
||||||
@ -17,7 +16,6 @@ import javax.sql.DataSource
|
|||||||
* [Kodein] controller module containing the app configuration
|
* [Kodein] controller module containing the app configuration
|
||||||
*/
|
*/
|
||||||
val configurationModule = Kodein.Module(name = "Configuration") {
|
val configurationModule = Kodein.Module(name = "Configuration") {
|
||||||
constant("config file") with "/application.dev.yaml" // FIXME
|
|
||||||
bind() from singleton {
|
bind() from singleton {
|
||||||
val configFile by this.kodein.instance<String>(tag = "config file")
|
val configFile by this.kodein.instance<String>(tag = "config file")
|
||||||
ConfigLoader().loadConfigOrThrow<Config>(configFile)
|
ConfigLoader().loadConfigOrThrow<Config>(configFile)
|
||||||
|
|||||||
@ -2,20 +2,6 @@ version: '2.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
caddy:
|
|
||||||
build:
|
|
||||||
dockerfile: Dockerfile.caddy
|
|
||||||
context: .
|
|
||||||
container_name: notes-caddy
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Brussels
|
|
||||||
volumes:
|
|
||||||
- notes-caddy-data:/data
|
|
||||||
- notes-caddy-config:/config
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
- 443:443
|
|
||||||
|
|
||||||
api:
|
api:
|
||||||
build:
|
build:
|
||||||
dockerfile: Dockerfile.api
|
dockerfile: Dockerfile.api
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
:8080
|
|
||||||
root dist
|
|
||||||
file_server {
|
|
||||||
# If we visit /404.html directly we receive a 404 response, and not a 200.
|
|
||||||
hide 404.html
|
|
||||||
}
|
|
||||||
encode gzip
|
|
||||||
|
|
||||||
handle_errors {
|
|
||||||
@404 {
|
|
||||||
expression {http.error.status_code} == 404
|
|
||||||
}
|
|
||||||
rewrite @404 /404.html
|
|
||||||
file_server
|
|
||||||
}
|
|
||||||
|
|
||||||
log {
|
|
||||||
format single_field common_log
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -5,8 +5,7 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
src: local('Roboto'), local('Roboto-Regular'),
|
src: local('Roboto'), local('Roboto-Regular'),
|
||||||
url('/fonts/roboto-v20-latin-regular.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
|
url('./fonts/roboto-v20-latin-regular.woff2') format('woff2')
|
||||||
url('/fonts/roboto-v20-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -116,10 +116,6 @@ export default {
|
|||||||
this.$vuetify.theme.dark = !this.$vuetify.theme.dark
|
this.$vuetify.theme.dark = !this.$vuetify.theme.dark
|
||||||
const theme = this.$vuetify.theme.dark ? 'dark' : 'light'
|
const theme = this.$vuetify.theme.dark ? 'dark' : 'light'
|
||||||
localStorage.setItem('theme', theme)
|
localStorage.setItem('theme', theme)
|
||||||
this.$cookies.set('theme', theme, {
|
|
||||||
path: '/',
|
|
||||||
maxAge: 60 * 60 * 24 * 7,
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
import colors from 'vuetify/es5/util/colors'
|
export default ({ command }) => ({
|
||||||
import { config } from 'dotenv'
|
|
||||||
|
|
||||||
const env = config().parsed
|
|
||||||
|
|
||||||
export default {
|
|
||||||
mode: 'universal',
|
mode: 'universal',
|
||||||
/*
|
/*
|
||||||
** Headers of the page
|
** Headers of the page
|
||||||
@ -26,16 +21,7 @@ export default {
|
|||||||
content: process.env.npm_package_description || '',
|
content: process.env.npm_package_description || '',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
link: [
|
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
|
||||||
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
|
|
||||||
{
|
|
||||||
rel: 'preload',
|
|
||||||
href: '/fonts/roboto-v20-latin-regular.woff2',
|
|
||||||
as: 'font',
|
|
||||||
type: 'font/woff2',
|
|
||||||
crossorigin: 'anonymous',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
** Customize the progress-bar color
|
** Customize the progress-bar color
|
||||||
@ -64,9 +50,9 @@ export default {
|
|||||||
// Doc: https://axios.nuxtjs.org/usage
|
// Doc: https://axios.nuxtjs.org/usage
|
||||||
'@nuxtjs/axios',
|
'@nuxtjs/axios',
|
||||||
// Doc: https://github.com/nuxt-community/dotenv-module
|
// Doc: https://github.com/nuxt-community/dotenv-module
|
||||||
'@nuxtjs/dotenv',
|
|
||||||
'@nuxtjs/auth',
|
'@nuxtjs/auth',
|
||||||
'cookie-universal-nuxt',
|
// Doc: https://github.com/nuxt-community/robots-module
|
||||||
|
'@nuxtjs/robots',
|
||||||
],
|
],
|
||||||
/*
|
/*
|
||||||
** Axios module configuration
|
** Axios module configuration
|
||||||
@ -74,8 +60,8 @@ export default {
|
|||||||
*/
|
*/
|
||||||
axios: {},
|
axios: {},
|
||||||
|
|
||||||
env: {
|
publicRuntimeConfig: {
|
||||||
API_HOST: env.API_HOST,
|
API_HOST: process.env.API_HOST,
|
||||||
},
|
},
|
||||||
|
|
||||||
auth: {
|
auth: {
|
||||||
@ -85,12 +71,7 @@ export default {
|
|||||||
home: '/notes',
|
home: '/notes',
|
||||||
},
|
},
|
||||||
watchLoggedIn: true,
|
watchLoggedIn: true,
|
||||||
cookie: {
|
cookie: !command.includes('generate'),
|
||||||
prefix: 'auth.',
|
|
||||||
options: {
|
|
||||||
path: '/',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
strategies: {
|
strategies: {
|
||||||
_scheme: 'local',
|
_scheme: 'local',
|
||||||
_name: 'local',
|
_name: 'local',
|
||||||
@ -190,4 +171,17 @@ export default {
|
|||||||
components: true,
|
components: true,
|
||||||
|
|
||||||
telemetry: false,
|
telemetry: false,
|
||||||
}
|
|
||||||
|
robots: {
|
||||||
|
UserAgent: '*',
|
||||||
|
Disallow: '/',
|
||||||
|
},
|
||||||
|
|
||||||
|
render: {
|
||||||
|
bundleRenderer: {
|
||||||
|
shouldPrefetch: () => false,
|
||||||
|
shouldPreload: (_, asType) =>
|
||||||
|
['font', 'script', 'style'].includes(asType),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|||||||
@ -15,9 +15,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/auth": "^4.9.1",
|
"@nuxtjs/auth": "^4.9.1",
|
||||||
"@nuxtjs/axios": "^5.3.6",
|
"@nuxtjs/axios": "^5.3.6",
|
||||||
"@nuxtjs/dotenv": "^1.4.0",
|
"@nuxtjs/robots": "^2.4.2",
|
||||||
"@starptech/prettyhtml-hast-to-html": "^0.10.0",
|
"@starptech/prettyhtml-hast-to-html": "^0.10.0",
|
||||||
"cookie-universal-nuxt": "^2.1.4",
|
|
||||||
"nuxt": "^2.13.0",
|
"nuxt": "^2.13.0",
|
||||||
"remark": "^12.0.0",
|
"remark": "^12.0.0",
|
||||||
"remark-breaks": "^1.0.5",
|
"remark-breaks": "^1.0.5",
|
||||||
|
|||||||
@ -43,7 +43,7 @@ export default {
|
|||||||
...mapGetters('notes', ['isEmpty']),
|
...mapGetters('notes', ['isEmpty']),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.initialized) this.load()
|
if (!this.isInitialized) this.load()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('notes', ['load']),
|
...mapActions('notes', ['load']),
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -9,5 +9,4 @@ check_installed() {
|
|||||||
|
|
||||||
check_installed docker-compose
|
check_installed docker-compose
|
||||||
|
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
|
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build
|
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d --build
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user