Add k8s deploy config

This commit is contained in:
Garrett Mills 2022-06-07 23:07:37 -05:00
parent 2fede56806
commit 01abe766c7
16 changed files with 167 additions and 113 deletions

2
.gitignore vendored
View File

@ -3,12 +3,14 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff # User-specific stuff
.idea
.idea/**/workspace.xml .idea/**/workspace.xml
.idea/**/tasks.xml .idea/**/tasks.xml
.idea/**/usage.statistics.xml .idea/**/usage.statistics.xml
.idea/**/dictionaries .idea/**/dictionaries
.idea/**/shelf .idea/**/shelf
# Generated files # Generated files
.idea/**/contentModel.xml .idea/**/contentModel.xml

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -1,40 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="OBJECT_LITERAL_WRAP" value="2" />
</JSCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
<option name="OBJECT_LITERAL_WRAP" value="2" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="www_1@db03.millslan.net" uuid="1002a9b7-c04c-43d0-bbbf-bd2c4fc7b6a9">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://db03.millslan.net:5432/www_1</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="@db03.millslan.net" uuid="afe39e7a-503d-4718-abe7-8bfb0428771b">
<driver-ref>mongo</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.dbschema.MongoJdbcDriver</jdbc-driver>
<jdbc-url>mongodb://db03.millslan.net:27017</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/exbuild" />
<excludeFolder url="file://$MODULE_DIR$/lib" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="di" />
<orderEntry type="module" module-name="lib" />
</component>
</module>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/../di/.idea/di.iml" filepath="$PROJECT_DIR$/../di/.idea/di.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/extollo.iml" filepath="$PROJECT_DIR$/.idea/extollo.iml" />
<module fileurl="file://$PROJECT_DIR$/../extollo_lib/.idea/lib.iml" filepath="$PROJECT_DIR$/../extollo_lib/.idea/lib.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

14
deploy/certificate.yaml Normal file
View File

@ -0,0 +1,14 @@
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: garrettmills-dev-tls
spec:
secretName: garrettmills-dev-tls-secret
dnsNames:
- 'garrettmills.dev'
- 'www.garrettmills.dev'
- 'k8s.garrettmills.dev'
issuerRef:
name: letsencrypt-ca
kind: ClusterIssuer

81
deploy/deployment.yaml Normal file
View File

@ -0,0 +1,81 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: garrettmills-dev
spec:
selector:
matchLabels:
app: garrettmills-dev
template:
metadata:
name: garrettmills-dev-www
labels:
app: garrettmills-dev
spec:
containers:
- name: garrettmills-www
image: registry.millslan.net/garrettmills/www
env:
- name: EXTOLLO_LOGGING_LEVEL
value: '4'
- name: SERVER_FORCE_SSL
value: 'true'
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: DATABASE_USERNAME
optional: false
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: DATABASE_PASSWORD
optional: false
- name: DATABASE_HOST
value: "$(PGSQL_POSTGRESQL_SERVICE_HOST)"
- name: REDIS_HOST
value: redis.redis.svc.cluster.local
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: REDIS_PASSWORD
optional: false
- name: DATABASE_NAME
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: DATABASE_NAME
optional: false
- name: GOTIFY_SERVER
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: GOTIFY_SERVER
optional: false
- name: GOTIFY_TOKEN
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: GOTIFY_TOKEN
optional: false
- name: COREID_CLIENT_ID
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: COREID_CLIENT_ID
optional: false
- name: COREID_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: COREID_CLIENT_SECRET
optional: false
- name: COREID_BASE
valueFrom:
secretKeyRef:
name: garrettmills-dev-secrets
key: COREID_BASE
optional: false

44
deploy/ingress.yaml Normal file
View File

@ -0,0 +1,44 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: garrettmills-dev-ingress
spec:
tls:
- hosts:
- garrettmills.dev
- www.garrettmills.dev
- k8s.garrettmills.dev
secretName: garrettmills-dev-tls-secret
ingressClassName: nginx
rules:
- host: garrettmills.dev
http:
paths:
- pathType: Prefix
path: '/'
backend:
service:
name: garrettmills-dev-service
port:
number: 80
- host: www.garrettmills.dev
http:
paths:
- pathType: Prefix
path: '/'
backend:
service:
name: garrettmills-dev-service
port:
number: 80
- host: k8s.garrettmills.dev
http:
paths:
- pathType: Prefix
path: '/'
backend:
service:
name: garrettmills-dev-service
port:
number: 80

11
deploy/service.yaml Normal file
View File

@ -0,0 +1,11 @@
---
apiVersion: v1
kind: Service
metadata:
name: garrettmills-dev-service
spec:
selector:
app: garrettmills-dev
ports:
- port: 80
targetPort: 8000

View File

@ -8,7 +8,7 @@
"lib": "lib" "lib": "lib"
}, },
"dependencies": { "dependencies": {
"@extollo/lib": "^0.9.43", "@extollo/lib": "^0.9.46",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"feed": "^4.2.2", "feed": "^4.2.2",
"gotify": "^1.1.0", "gotify": "^1.1.0",

View File

@ -2,7 +2,7 @@ lockfileVersion: 5.3
specifiers: specifiers:
'@extollo/cc': ^0.6.0 '@extollo/cc': ^0.6.0
'@extollo/lib': ^0.9.43 '@extollo/lib': ^0.9.46
copyfiles: ^2.4.1 copyfiles: ^2.4.1
feed: ^4.2.2 feed: ^4.2.2
gotify: ^1.1.0 gotify: ^1.1.0
@ -14,7 +14,7 @@ specifiers:
zod: ^3.11.6 zod: ^3.11.6
dependencies: dependencies:
'@extollo/lib': 0.9.43 '@extollo/lib': 0.9.46
copyfiles: 2.4.1 copyfiles: 2.4.1
feed: 4.2.2 feed: 4.2.2
gotify: 1.1.0 gotify: 1.1.0
@ -114,8 +114,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@extollo/lib/0.9.43: /@extollo/lib/0.9.46:
resolution: {integrity: sha512-gsoP/q638AiMdMe9AReiuEqibm5Y6jMVQbmICOgAPZRLJWTiuc5+puEHUWyuvBcuP0w8YxNS+Vn/hZeF/EECLQ==} resolution: {integrity: sha512-FbCCM0X++TCGeCrBVCS2CtshDbwu9Hv2qUFbx2m+8UHq3JX/pHnbjePBAWgAgpRVu7Sp221rFdaaOv27i+Lu9Q==}
dependencies: dependencies:
'@atao60/fse-cli': 0.1.7 '@atao60/fse-cli': 0.1.7
'@extollo/ui': 0.1.0_@types+node@14.18.12 '@extollo/ui': 0.1.0_@types+node@14.18.12
@ -891,7 +891,7 @@ packages:
requiresBuild: true requiresBuild: true
dependencies: dependencies:
buildcheck: 0.0.3 buildcheck: 0.0.3
nan: 2.15.0 nan: 2.16.0
dev: false dev: false
optional: true optional: true
@ -1278,7 +1278,7 @@ packages:
source-map: 0.6.1 source-map: 0.6.1
wordwrap: 1.0.0 wordwrap: 1.0.0
optionalDependencies: optionalDependencies:
uglify-js: 3.15.4 uglify-js: 3.16.0
dev: false dev: false
/has-flag/4.0.0: /has-flag/4.0.0:
@ -1721,8 +1721,8 @@ packages:
/mute-stream/0.0.8: /mute-stream/0.0.8:
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
/nan/2.15.0: /nan/2.16.0:
resolution: {integrity: sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==} resolution: {integrity: sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==}
dev: false dev: false
optional: true optional: true
@ -2291,7 +2291,7 @@ packages:
bcrypt-pbkdf: 1.0.2 bcrypt-pbkdf: 1.0.2
optionalDependencies: optionalDependencies:
cpu-features: 0.0.3 cpu-features: 0.0.3
nan: 2.15.0 nan: 2.16.0
dev: false dev: false
/standard-as-callback/2.1.0: /standard-as-callback/2.1.0:
@ -2690,8 +2690,8 @@ packages:
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
/uglify-js/3.15.4: /uglify-js/3.16.0:
resolution: {integrity: sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==} resolution: {integrity: sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw==}
engines: {node: '>=0.8.0'} engines: {node: '>=0.8.0'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true

View File

@ -4,5 +4,6 @@ export default {
connection: { connection: {
port: env('REDIS_PORT', 6379), port: env('REDIS_PORT', 6379),
host: env('REDIS_HOST', '127.0.0.1'), host: env('REDIS_HOST', '127.0.0.1'),
password: env('REDIS_PASSWORD'),
} as RedisOptions } as RedisOptions
} }

View File

@ -12,6 +12,8 @@ import {
export default { export default {
debug: env('DEBUG_MODE', false), debug: env('DEBUG_MODE', false),
forceSsl: env('SERVER_FORCE_SSL', false),
session: { session: {
/* The implementation of @extollo/lib.Session that serves as the session backend. */ /* The implementation of @extollo/lib.Session that serves as the session backend. */
driver: ORMSession, driver: ORMSession,