aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-06-06 21:31:30 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-06-06 21:31:30 -0400
commit9d1df65d99732a68b4fe96dcc75273442cbd322f (patch)
tree9a28619f6caaf68d47ea0e620c62da3ea3aeaf81
parent5ecd6b39cccdc9500540b10685605b5fcba61f69 (diff)
fix: Some container fixes and compatability
-rw-r--r--ci/build.env7
-rw-r--r--ci/config-templates/Essentials.Accounts-template.json4
-rw-r--r--ci/config-templates/config-template.json2
-rw-r--r--ci/container/Dockerfile3
-rw-r--r--ci/container/Taskfile.yaml24
-rw-r--r--ci/container/docker-compose.yaml4
-rw-r--r--front-end/.env2
-rw-r--r--front-end/src/main.ts2
8 files changed, 28 insertions, 20 deletions
diff --git a/ci/build.env b/ci/build.env
index 0c8da94..d0739af 100644
--- a/ci/build.env
+++ b/ci/build.env
@@ -8,6 +8,13 @@
#
##########
+# _internal_
+##########
+
+#default compression lib for bare metal
+COMPRESSION_LIB_PATH=lib/vnlib_compress.dll
+
+##########
# Plugins
##########
diff --git a/ci/config-templates/Essentials.Accounts-template.json b/ci/config-templates/Essentials.Accounts-template.json
index ed91193..0f51e3d 100644
--- a/ci/config-templates/Essentials.Accounts-template.json
+++ b/ci/config-templates/Essentials.Accounts-template.json
@@ -63,11 +63,11 @@
//Path/domain for all security cookies
"cookie_domain": "",
"cookie_path": "/",
- "status_cookie_name": "li", //front-end cookie name must match to detect login status
+ "status_cookie_name": "cmn-li", //front-end cookie name must match to detect login status
"otp_header_name": "X-Web-Token", //Front-end header name must match
"otp_time_diff_sec": 30,
"otp_key_size": 64,
- "pubkey_cookie_name": "client-id",
+ "pubkey_cookie_name": "cmn-id",
"pubkey_signing_key_size": 32,
"strict_origin": false,
"strict_path": true, //Can be enabled if front-end is running on the same server
diff --git a/ci/config-templates/config-template.json b/ci/config-templates/config-template.json
index b548587..bd67020 100644
--- a/ci/config-templates/config-template.json
+++ b/ci/config-templates/config-template.json
@@ -41,7 +41,7 @@
//Setup the native lib
"vnlib.net.compression": {
- "lib_path": "lib/vnlib_compress.dll",
+ "lib_path": "${COMPRESSION_LIB_PATH}",
"level": 1
},
diff --git a/ci/container/Dockerfile b/ci/container/Dockerfile
index 8ae12f6..5268448 100644
--- a/ci/container/Dockerfile
+++ b/ci/container/Dockerfile
@@ -52,7 +52,8 @@ ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0
#add helper/required libraries
#ENV VNLIB_SHARED_HEAP_FILE_PATH=/app/lib/libvn_rpmalloc.so not ready yet, still need to debug
-ENV VNLIB_ARGON2_DLL_PATH=/app/lib/libargon2.so
+ENV VNLIB_ARGON2_DLL_PATH=/app/lib/libargon2.so \
+ COMPRESSION_LIB_PATH=/app/lib/libvn_compress.so
#set default env variables
ENV MAX_CONTENT_LENGTH=204800000 \
diff --git a/ci/container/Taskfile.yaml b/ci/container/Taskfile.yaml
index 5987eaa..0b959ab 100644
--- a/ci/container/Taskfile.yaml
+++ b/ci/container/Taskfile.yaml
@@ -8,6 +8,7 @@ version: "3"
vars:
INCLUDE_FILES: "Dockerfile, docker-compose.yaml"
+ CERT_KEY_PARAMS: "ec -pkeyopt ec_paramgen_curve:secp384r1"
includes:
install:
@@ -19,22 +20,21 @@ tasks:
build-libs:
vars:
OUT_DIR: "{{.USER_WORKING_DIR}}/out"
-
- #build stage generates the following libraries
- generates:
- - "{{.USER_WORKING_DIR}}/out/libargon2.so"
- - "{{.USER_WORKING_DIR}}/out/libvn_rpmalloc.so"
- - "{{.USER_WORKING_DIR}}/out/libvn_compress.so"
-
+ SSL_DIR: "{{.USER_WORKING_DIR}}/ssl"
+ HOSTNAME:
+ sh: echo $HOSTNAME
+
cmds:
#build argon2 native library
- cd lib/argon2/ && task && cp build/libargon2.so {{.OUT_DIR}}/libargon2.so
- #build rpmalloc library
- - cd lib/vnlib_rpmalloc/ && task && cp build/libvn_rpmalloc.so {{.OUT_DIR}}/libvn_rpmalloc.so
- #install zlib and brotli native libraries from the source repos
+ #build rpmalloc library and rewrite to a standard .dll extension
+ - cd lib/vnlib_rpmalloc/ && task && cp build/libvn_rpmalloc.so {{.OUT_DIR}}/libvn_rpmalloc.so
+ #build compression and rewrite to a standard .dll extension
- cd lib/vnlib_compress/ && task && cp build/libvn_compress.so {{.OUT_DIR}}/libvn_compress.so
- #build native compression lib and put in lib dir
- - cd lib/vnlib_compress && cmake -B./build && cmake --build build/ --config Release && cp build/libvn_compress.so {{.OUT_DIR}}/libvn_compress.so
+
+ #create a fresh self-signed cert for the container during build
+ - openssl req -new -x509 -days 365 -keyout {{.SSL_DIR}}/key.pem -out {{.SSL_DIR}}/cert.pem -newkey {{.CERT_KEY_PARAMS}} --nodes -subj "/CN={{.HOSTNAME}}"
+ - echo "WARNING Self signed certificate created during build stage, DO NOT COPY THIS IMAGE"
#called from ci pipline to build the package
build:
diff --git a/ci/container/docker-compose.yaml b/ci/container/docker-compose.yaml
index 5a029c6..9bd1fc1 100644
--- a/ci/container/docker-compose.yaml
+++ b/ci/container/docker-compose.yaml
@@ -20,7 +20,7 @@ services:
CHANNEL_INDEX_FILE: "channels.json" #required, should leave default unless you know what you are doing
MAX_CONTENT_LENGTH: 204800000 #200MB max upload size
MAX_LOGIN_ATTEMPS: "10" #max login attempts before user account is locked out
-
+
#SQL Config
SQL_LIB_PATH: "VNLib.Plugins.Extensions.Sql.SQLite.dll"
SQL_CONNECTION_STRING: "Data Source=data/cmnext.db;" #when using a password, simply leave the password field blank
@@ -69,5 +69,5 @@ services:
#Very Verbose plugin logging, required --debug CLI flag, prints literally everything to the logger (it's annoying)
DEBUG_PLUGINS: "false"
- SERVER_ARGS: "--setup" #remove the setup flag after you are done setting up the server
+ SERVER_ARGS: ""
diff --git a/front-end/.env b/front-end/.env
index 710aaa0..ded10d3 100644
--- a/front-end/.env
+++ b/front-end/.env
@@ -4,7 +4,7 @@ VITE_CORS_ENABLED=false
#The VNLib.Plugins.Essentials.Accounts plugin security header value
VITE_WEB_TOKEN_HEADER="X-Web-Token"
-VITE_LOGIN_COOKIE_ID="li"
+VITE_LOGIN_COOKIE_ID="cmn-li"
VITE_PKI_ENABLED=true
diff --git a/front-end/src/main.ts b/front-end/src/main.ts
index ac32bb6..b3a5ad7 100644
--- a/front-end/src/main.ts
+++ b/front-end/src/main.ts
@@ -57,7 +57,7 @@ import { cmnextAdminPlugin } from './store/cmnextAdminPlugin'
configureApi({
session: {
//The identifier of the login cookie, see Essentials.Accounts docs
- loginCookieName: 'li',
+ loginCookieName: import.meta.env.VITE_LOGIN_COOKIE_ID,
browserIdSize: 32,
},
user: {