diff options
Diffstat (limited to 'ci')
-rw-r--r-- | ci/config/SimpleBookmark.json | 16 | ||||
-rw-r--r-- | ci/config/config.json | 15 | ||||
-rw-r--r-- | ci/container/Dockerfile | 89 | ||||
-rw-r--r-- | ci/container/Taskfile.yaml | 91 | ||||
-rw-r--r-- | ci/container/config-templates/Essentials.Accounts-template.json | 76 | ||||
-rw-r--r-- | ci/container/config-templates/PageRouter-template.json | 6 | ||||
-rw-r--r-- | ci/container/config-templates/SessionProvider-template.json | 21 | ||||
-rw-r--r-- | ci/container/config-templates/SimpleBookmark-template.json | 22 | ||||
-rw-r--r-- | ci/container/config-templates/config-template.json | 166 | ||||
-rw-r--r-- | ci/container/docker-compose.yaml | 45 | ||||
-rw-r--r-- | ci/container/run.sh | 15 | ||||
-rw-r--r-- | ci/container/static/routes.xml | 46 | ||||
-rw-r--r-- | ci/install.taskfile.yaml | 19 | ||||
-rw-r--r-- | ci/plugins.taskfile.yaml | 75 | ||||
-rw-r--r-- | ci/taskfile.yaml | 86 |
15 files changed, 682 insertions, 106 deletions
diff --git a/ci/config/SimpleBookmark.json b/ci/config/SimpleBookmark.json index f097602..6cb1b93 100644 --- a/ci/config/SimpleBookmark.json +++ b/ci/config/SimpleBookmark.json @@ -1,16 +1,22 @@ { //Comments are allowed - "debug": false, + "debug": false, //Enables obnoxious debug logging "bm_endpoint": { - "path": "/api/bookmarks", //Path for the bookmarks endpoint + "path": "/api/bookmarks", //Path for the bookmarks endpoint "config": { - "max_limit": 100, //Max results per page - "default_limit": 20, //Default results per page - "user_quota": 5000 //Max bookmarks per user + "max_limit": 100, //Max results per page + "default_limit": 20, //Default results per page + "user_quota": 5000 //Max bookmarks per user } + }, + + "registration": { + "path": "/api/register", //Path for the registration endpoint + "token_lifetime_mins": 360, //Token lifetime in minutes + "key_regen_interval_mins": 3600 //Signing key regeneration interval in minutes } }
\ No newline at end of file diff --git a/ci/config/config.json b/ci/config/config.json index 4740cd3..e4b33e8 100644 --- a/ci/config/config.json +++ b/ci/config/config.json @@ -84,6 +84,7 @@ "X-Content-Type-Options": "nosniff", "X-Xss-Protection": "1; mode=block", "X-Frame-Options": "DENY", + "Server":"VNLib.Webserver", "Content-Security-Policy": "default-src 'self' 'unsafe-inline'; img-src 'self' blob: data:; frame-src 'none'; object-src 'none'; referrer no-referrer-when-downgrade; upgrade-insecure-requests; block-all-mixed-content;" }, @@ -125,7 +126,7 @@ "reload_delay_sec": 2, "path": "plugins", "config_dir": "config", - "assets": "plugins/assets" + "assets": "plugins/assets/" }, "disabled sys_log": { @@ -148,15 +149,9 @@ //Sql for the users database "sql": { - "db_type": "sqlite", //mysql, mssql(default), sqlite - "source": "simple-bookmark.db" //For sqlite only - - //"hostname": "example.com", - //"username": "simple-bookmark", - //"catalog": "simple-bookmark", - //"min_pool_size": 5, - //"ms_security": false - //"trust_cert": false + "debug": false, + "provider": "VNLib.Plugins.Extensions.Sql.SQLite.dll", + "source": "simple-bookmark.db" //For sqlite only }, //caching should be setup globally after VNCache #78a47dd diff --git a/ci/container/Dockerfile b/ci/container/Dockerfile new file mode 100644 index 0000000..365f1c7 --- /dev/null +++ b/ci/container/Dockerfile @@ -0,0 +1,89 @@ +#Copyright (c) Vaughn Nugent +#Licensed under the GNU AGPL V3.0 + +#use plain alpine latest to build native libraries in +FROM alpine:3.19 as native-cont + +#install public libs and build tools +RUN apk update && apk add build-base cmake npm git +#most universal way to use Task is from NPM +RUN npm install -g @go-task/cli + +WORKDIR /build + +#include local artifacts +COPY app/ . + +#build internal libraries and copy the libraries to the /lib output directory +RUN mkdir out/ +RUN task build-libs + +#APP CONTAINER +#move into a clean dotnet apline lean image +FROM mcr.microsoft.com/dotnet/runtime:8.0.2-alpine3.19-amd64 as app-cont + +LABEL name="vnuge/simple-bookmark" +LABEL maintainer="Vaughn Nugent <vnpublic@proton.me>" +LABEL description="A linkding inspired, self hosted, bookmark manager" + +#copy local artifacts again in run container +COPY app/ /app + +#pull compiled libs from build container +COPY --from=native-cont /build/out /app/lib + +RUN apk update && apk add --no-cache gettext icu-libs dumb-init + +#workdir +WORKDIR /app + +#default to 8080 for TLS on TCP +EXPOSE 8080/tcp + +VOLUME /app/data +VOLUME /app/ssl +#expose an assets directory for custom assets install +VOLUME /app/usr/assets + +#disable dotnet invariant culture on alpine +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 + +#set default env variables +ENV MAX_BOOKMARKS=5000 + +#SQL Config +ENV SQL_LIB_PATH=VNLib.Plugins.Extensions.Sql.SQLite.dll +ENV SQL_CONNECTION_STRING="Data Source=data/simple-bookmark.db;" + +#ACCOUNTS +ENV MAX_LOGIN_ATTEMPS=10 + +#HC Vault +ENV HC_VAULT_ADDR="" +ENV HC_VAULT_TOKEN="" + +#VNCACHE (default to memory only) +ENV CACHE_ASM_PATH=VNLib.Data.Caching.Providers.VNCache.dll +ENV MEMCACHE_ONLY=true +ENV REDIS_CONNECTION_STRING="" +ENV VNCACHE_INITIAL_NODES=[] + +#SECRETS +ENV PASSWORD_PEPPER="" +ENV DATABASE_PASSWORD="" +ENV REDIS_PASSWORD="" +ENV VNCACHE_CLIENT_PRIVATE_KEY="" +ENV VNCACHE_CACHE_PUBLIC_KEY="" + +#HTTP/PROXY Config +ENV HTTP_DOWNSTREAM_SERVERS=[] +ENV SSL_JSON="{}" + +#run the init script within dumb-init +ENTRYPOINT ["dumb-init", "--"] +CMD ["ash", "./run.sh"] + diff --git a/ci/container/Taskfile.yaml b/ci/container/Taskfile.yaml new file mode 100644 index 0000000..19ce71c --- /dev/null +++ b/ci/container/Taskfile.yaml @@ -0,0 +1,91 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +version: "3" + +vars: + BUILDS_URL: https://www.vaughnnugent.com/public/resources/software/builds + PACKAGE_FILE_NAME: "sb-alpine3.19-oci.tgz" + INCLUDE_FILES: "Dockerfile, docker-compose.yaml" + +includes: + install: + taskfile: ../install.taskfile.yaml + optional: true #not needed for inside container build + +tasks: + + #called from inside the container to build native libraries + 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" + + cmds: + #build argon2 lib + - 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 (they dont have active releases anymore :() + - mkdir -p lib/third-party + - cd lib/third-party && git clone https://github.com/cloudflare/zlib.git + - cd lib/third-party && git clone https://github.com/google/brotli.git + #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 + + + #called from ci pipline to build the package + build: + vars: + SQLITE_RUNTIMES: 'build/app/plugins/assets/VNLib.Plugins.Extensions.Loading.Sql.SQLite/runtimes' + cmds: + - cmd: wsl dos2unix ./run.sh + #make build directory + - cmd: powershell -Command "mkdir build, build/app, build/app/config-templates/, build/app/static/ -Force" + #copy the existing linux-x64 build to the build folder + - cmd: powershell -Command "cp -Recurse -Force ../build/linux-x64/* build/app/" + #copy local scripts into the build folder + - cmd: powershell -Command "cp -Force run.sh, Taskfile.yaml build/app/" + - cmd: powershell -Command "cp -Force Dockerfile, docker-compose.yaml build/" + - cmd: powershell -Command "cp -Force static/* build/app/static/" + - cmd: powershell -Command "cp -Force config-templates/* build/app/config-templates/" + #remove the default config file as it's not needed in the container + - cmd: powershell -Command "rm -Force build/app/config.json" + - cmd: powershell -Command "rm -Force -Recurse build/app/config/" + + #move the linux-musl-x64 directory out of assets before removing the rest of the runtimes and then move it back + - cmd: powershell -Command "mv {{.SQLITE_RUNTIMES}}/linux-musl-x64 build/linux-musl-x64" + - cmd: powershell -Command "rm -Recurse -Force {{.SQLITE_RUNTIMES}}" && powershell -Command "mkdir {{.SQLITE_RUNTIMES}}" + - cmd: powershell -Command "mv build/linux-musl-x64 {{.SQLITE_RUNTIMES}}/linux-musl-x64 " + + #install rpmalloc + - task: install-rpmalloc-lib + + postbuild_success: + cmds: + #tar up the build directory and move it to the output bin directory + - cmd: cd build/ && tar -czf ../../bin/{{.PACKAGE_FILE_NAME}} . + + clean: + ignore_error: true + cmds: + - cmd: powershell -Command "rm -Recurse -Force ./build" + + + install-rpmalloc-lib: + internal: true + cmds: + #install compressor plugin + - task: install:install + vars: + PROJECT_NAME: 'vnlib_rpmalloc' + MODULE_NAME: "VNLib.Core" + FILE_NAME: "src.tgz" + DIR: './build/app/lib/vnlib_rpmalloc'
\ No newline at end of file diff --git a/ci/container/config-templates/Essentials.Accounts-template.json b/ci/container/config-templates/Essentials.Accounts-template.json new file mode 100644 index 0000000..6e36986 --- /dev/null +++ b/ci/container/config-templates/Essentials.Accounts-template.json @@ -0,0 +1,76 @@ +{ + "debug": false, + + //endpoints + + "login_endpoint": { + "path": "/api/account/login", + "max_login_attempts": ${MAX_LOGIN_ATTEMPS}, //10 failed attempts in 10 minutes + "failed_attempt_timeout_sec": 600 //10 minutes + }, + + "keepalive_endpoint": { + "path": "/api/account/keepalive", + //Regen token every 10 mins along with cookies + "token_refresh_sec": 600 //10 minutes + }, + + "profile_endpoint": { + "path": "/api/account/profile" + }, + + "password_endpoint": { + "path": "/api/account/reset" + }, + + "mfa_endpoint": { + "path": "/api/account/mfa" + }, + + "logout_endpoint": { + "path": "/api/account/logout" + }, + + "pki_auth_endpoint": { + "path": "/api/account/pki", + "jwt_time_dif_sec": 30, + "max_login_attempts": 10, + "failed_attempt_timeout_sec": 600, + //Configures the PATCH and DELETE methods to update the user's stored key when logged in + "enable_key_update": true + }, + + //If mfa is defined, configures mfa enpoints and enables mfa logins + "mfa": { + "upgrade_expires_secs": 180, + "nonce_size": 64, + + //Defines totp specific arguments + "totp": { + "digits": 6, + "issuer": "Simple-Bookmark", + "period_secs": 30, + "algorithm": "sha1", + "secret_size": 32, + "window_size": 2 + } + }, + + //Defines the included account provider + "account_security": { + //Time in seconds before a session is considered expired + "session_valid_for_sec": 3600, + //Path/domain for all security cookies + "cookie_domain": "", + "cookie_path": "/", + "status_cookie_name": "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_signing_key_size": 32, + "strict_origin": false, + "strict_path": true, //Can be enabled if front-end is running on the same server + //"allowed_origins": [""] + } +}
\ No newline at end of file diff --git a/ci/container/config-templates/PageRouter-template.json b/ci/container/config-templates/PageRouter-template.json new file mode 100644 index 0000000..7cfdf24 --- /dev/null +++ b/ci/container/config-templates/PageRouter-template.json @@ -0,0 +1,6 @@ +{ + "debug": false, + "store": { + "route_file": "static/routes.xml" + } +}
\ No newline at end of file diff --git a/ci/container/config-templates/SessionProvider-template.json b/ci/container/config-templates/SessionProvider-template.json new file mode 100644 index 0000000..e281edf --- /dev/null +++ b/ci/container/config-templates/SessionProvider-template.json @@ -0,0 +1,21 @@ +{ + + "debug": false, + + //Provider assemblies to load + "provider_assemblies": [ "VNLib.Plugins.Sessions.VNCache.dll" ], + + //Web session provider, valid format for VNCache and also memory sessions + "web": { + //Cache system key prefix + "cache_prefix": "websessions", + //The session cookie name + "cookie_name": "sb-session", + //Size in bytes for generated session ids + "cookie_size": 40, + //time (in seconds) a session is valid for + "valid_for_sec": 3600, + //The maxium number of connections waiting for the cache server responses + "max_waiting_connections": 100 + } +}
\ No newline at end of file diff --git a/ci/container/config-templates/SimpleBookmark-template.json b/ci/container/config-templates/SimpleBookmark-template.json new file mode 100644 index 0000000..6f39001 --- /dev/null +++ b/ci/container/config-templates/SimpleBookmark-template.json @@ -0,0 +1,22 @@ +{ + + //Comments are allowed + "debug": false, //Enables obnoxious debug logging + + "bm_endpoint": { + + "path": "/api/bookmarks", //Path for the bookmarks endpoint + + "config": { + "max_limit": 100, //Max results per page + "default_limit": 20, //Default results per page + "user_quota": ${MAX_BOOKMARKS} //Max bookmarks per user + } + }, + + "registration": { + "path": "/api/register", //Path for the registration endpoint + "token_lifetime_mins": 360, //Token lifetime in minutes + "key_regen_interval_mins": 3600 //Signing key regeneration interval in minutes + } +}
\ No newline at end of file diff --git a/ci/container/config-templates/config-template.json b/ci/container/config-templates/config-template.json new file mode 100644 index 0000000..10092dd --- /dev/null +++ b/ci/container/config-templates/config-template.json @@ -0,0 +1,166 @@ +{ + + //Host application config, config is loaded as a read-only DOM that is available + //to the host and loaded child plugins, all elements are available to plugins via the 'HostConfig' property + + "http": { + //The defaut HTTP version to being requests with (does not support http/2 yet) + "default_version": "HTTP/1.1", + //The maxium size (in bytes) of response messges that will be compressed + "compression_limit": 512000, + //Minium response size (in bytes) to compress + "compression_minimum": 2048, + //The size of the buffer to use when parsing multipart/form data uploads + "multipart_max_buf_size": 8192, + //The maxium ammount of data (in bytes) allows for mulitpart/form data file uploads + "multipart_max_size": 80240, + //Absolute maximum size (in bytes) of the request entity body (exludes headers) + "max_entity_size": 1024000, + //Keepalive ms for HTTP1.1 keepalive connections + "keepalive_ms": 1000000, + //The buffer size to use when parsing headers (also the maxium request header size allowed) + "header_buf_size": 8128, + //The maxium number of headers allowed in an HTTP request message + "max_request_header_count": 50, + //The maxium number of allowed network connections, before 503s will be issued automatically and connections closed + "max_connections": 5000, + //The size in bytes of the buffer to use when writing response messages + "response_buf_size": 4096, + //time (in ms) to wait for a response from an active connection in recv mode, before dropping it + "recv_timeout_ms": 5000, + //Time in ms to wait for the client to accept transport data before terminating the connection + "send_timeout_ms": 60000, + //The size (in bytes) of the buffer used to store all response header data + "response_header_buf_size": 16384, + //Max number of file uploads allowed per request + "max_uploads_per_request": 10 + }, + + //Compression is installed in the container at lib/ directory along with the native library supporting gzip and brotli + "compression_lib": "lib/vnlib.net.compression/VNLib.Net.Compression.dll", + + //Setup the native lib + "vnlib.net.compression": { + "lib_path": "lib/libvn_compress.so", + "level": 1 + }, + + + //Maxium ammount of time a request is allowed to be processed (includes loading or waiting for sessions) before operations will be cancelled and a 503 returned + "max_execution_time_ms": 20000, + + //Collection of objects to define hosts+interfaces to build server listeners from + "virtual_hosts": [ + { + //The interface to bind to, you may not mix TLS and non-TLS connections on the same interface + "interface": { + "address": "0.0.0.0", + "port": 8080 + }, + + //Collection of "trusted" servers to allow proxy header support from + "downstream_servers": ${HTTP_DOWNSTREAM_SERVERS}, + + //The hostname to listen for, "*" as wildcard, and "[system]" as the default hostname for the current machine + "hostname": "*", + "path": "dist/", + + //A list of file extensions to deny access to, if a resource is requested and has one of the following extensions, a 404 is returned + "deny_extensions": [ ".ts", ".json", ".htaccess", ".php" ], + //The default file extensions to append to a resource that does not have a file extension + "default_files": [ "index.html", "index.htm" ], + + //A list of error file objects, files are loaded into memory (and watched for changes) and returned when the specified error code occurs + "error_files": [], + + //The default + "cache_default_sec": 864000, + + "ssl": ${SSL_JSON}, + } + ], + + + //Defines the directory where plugin's are to be loaded from + "plugins": { + //Hot-reload creates collectable assemblies that allow full re-load support in the host application, should only be used for development purposes! + "hot_reload": false, + "path": "plugins/", + "config_dir": "config/", + "assets": "plugins/assets/" + }, + + "sys_log": { + "path": "data/logs/sys-log.txt", + "flush_sec": 5, + "retained_files": 31, + "file_size_limit": 10485760, + "interval": "infinite" + }, + + "app_log": { + "path": "data/logs/app-log.txt", + "flush_sec": 5, + "retained_files": 31, + "file_size_limit": 10485760, + "interval": "infinite" + }, + + //HASHICORP VAULT + "hashicorp_vault": { + "url": "${HC_VAULT_ADDR}", + "token": "${HC_VAULT_TOKEN}" + }, + + //SQL CONFIG + "sql": { + "provider": "${SQL_LIB_PATH}", + "connection_string": "${SQL_CONNECTION_STRING}" + }, + + //VNCACHE global config + //Enable vncache as the providers above rely on the object caching server + "cache": { + + "assembly_name": "${CACHE_ASM_PATH}", + "url": "${REDIS_CONNECTION_STRING}", + + //Max size (in bytes) of allowed data to be stored in each user's session object + "max_object_size": 8128, + + //Request timeout + "request_timeout_sec": 10, + + //Time delay between cluster node discovery + "discovery_interval_sec": 120, + + //Initial nodes to discover from + "initial_nodes": ${VNCACHE_INITIAL_NODES}, + + //Disable TLS + "use_tls": false, + + //Setting this value to true will cause the cache store to load a memory-only instance, without remote backing + "memory_only": ${MEMCACHE_ONLY}, + + //enable memory cache + "memory_cache": { + "buckets": 20, + "bucket_size": 5000, + "max_age_sec": 600, + "refresh_interval_sec": 60, + "zero_all": false, + "max_object_size": 8128 + } + }, + + "secrets": { + //Special key used by the loading library for access to the PasswordHashing library to pepper password hashes + "passwords": "${PASSWORD_PEPPER}", + "db_password": "${DATABASE_PASSWORD}", + "client_private_key": "${VNCACHE_CLIENT_PRIVATE_KEY}", + "cache_public_key": "${VNCACHE_CACHE_PUBLIC_KEY}", + "redis_password": "${REDIS_PASSWORD}" + } +} + diff --git a/ci/container/docker-compose.yaml b/ci/container/docker-compose.yaml new file mode 100644 index 0000000..0c3d1e1 --- /dev/null +++ b/ci/container/docker-compose.yaml @@ -0,0 +1,45 @@ +#Copyright (c) Vaughn Nugent +#Licensed under the GNU AGPLv3 + +version: '3.6' + +services: + simple-bookmark: + image: vnuge/simple-bookmark + container_name: simple-bookmark + restart: unless-stopped + volumes: + - ./data:/app/data + - ./assets:/app/usr/assets:ro + - ./ssl:/app/ssl:ro + ports: + - 8080:8080 + environment: + MAX_BOOKMARKS: "5000" + #SQL Config + SQL_LIB_PATH: "VNLib.Plugins.Extensions.Sql.SQLite.dll" + SQL_CONNECTION_STRING: "Data Source=data/simple-bookmark.db;" + #HC Vault + HC_VAULT_ADDR: "" + HC_VAULT_TOKEN: "" + #VNCACHE (default to memory only) + CACHE_ASM_PATH: "VNLib.Data.Caching.Providers.VNCache.dll" + MEMCACHE_ONLY: "true" + REDIS_CONNECTION_STRING: "" + VNCACHE_INITIAL_NODES: "[]" + #ACCOUNTS + MAX_LOGIN_ATTEMPS: "10" + + #SECRETS + PASSWORD_PEPPER: "" + DATABASE_PASSWORD: "" + REDIS_PASSWORD: "" + VNCACHE_CLIENT_PRIVATE_KEY: "" + VNCACHE_CACHE_PUBLIC_KEY: "" + + #HTTP + HTTP_DOWNSTREAM_SERVERS: "[]" + #SSL_JSON: '{"cert": "ssl/cert.pem", "privkey":"ssl/priv.pem"}' + + SERVER_ARGS: "--input-off" + diff --git a/ci/container/run.sh b/ci/container/run.sh new file mode 100644 index 0000000..2c2636c --- /dev/null +++ b/ci/container/run.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +#this script will be invoked by dumb-init in the container on statup and is located at /app + +rm -rf config && mkdir config + +#substitude all -template files in the config-templates dir and write them to the config dir +for file in config-templates/*-template.json; do + envsubst < $file > config/$(basename $file -template.json).json +done + +cp usr/assets/* plugins/assets/ -rf + +#start the server +dotnet webserver/VNLib.WebServer.dll --config config/config.json $SERVER_ARGS
\ No newline at end of file diff --git a/ci/container/static/routes.xml b/ci/container/static/routes.xml new file mode 100644 index 0000000..85f9830 --- /dev/null +++ b/ci/container/static/routes.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8" ?> + +<!--Routes container element holds a collection of route elements--> +<routes> + <!-- + Example route configuration for a single page app + where the tree looks like this: + / (index.html) + /assets (assets directory) (css and js files) + + Wildcard hosts match all hosts that do not have rules with more specific hosts + --> + + <!-- + Allow assets directory to pass through for all requests, using the Continue routine (1) + + Because this route has a more specific path than the catch all route + it will be processed first + --> + <route routine="1" privilege="0"> + + <!--Wildcard host--> + <hostname>*</hostname> + + <!--All paths that start with /assets/ will be matched--> + <path>/assets/*</path> + </route> + + <!--Show the index file when navigating to /--> + <route routine="4" privilege="0"> + <hostname>*</hostname> + <path>/</path> + <alternate>index.html</alternate> + </route> + + <!--Redirect all other pages back to the app (homepage)--> + <route routine="2" privilege="0"> + <hostname>*</hostname> + <path>/*</path> + <alternate>/</alternate> + </route> + + + <!--All routes that do not match will be allowed, this is only / since it does not have a matching rule--> + +</routes>
\ No newline at end of file diff --git a/ci/install.taskfile.yaml b/ci/install.taskfile.yaml new file mode 100644 index 0000000..e1624a3 --- /dev/null +++ b/ci/install.taskfile.yaml @@ -0,0 +1,19 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +version: "3" + +tasks: + + install: + internal: true + cmds: + #make the plugin directory + - cmd: powershell -Command "mkdir {{.DIR}} -Force" + ignore_error: true + - cd {{.DIR}} && powershell "{{ .PROJECT_DIR }}/install.ps1" -BaseUrl {{.BUILDS_URL}} -ModuleName {{.MODULE_NAME}} -ProjectName {{.PROJECT_NAME}} -FileName {{.FILE_NAME}} + - cd {{.DIR}} && tar -xzf {{.FILE_NAME}} + #remove the archive file + - cd {{.DIR}} && powershell -Command "rm {{.FILE_NAME}}"
\ No newline at end of file diff --git a/ci/plugins.taskfile.yaml b/ci/plugins.taskfile.yaml index 66641ab..f39121d 100644 --- a/ci/plugins.taskfile.yaml +++ b/ci/plugins.taskfile.yaml @@ -5,22 +5,29 @@ version: "3" +includes: + install: + taskfile: install.taskfile.yaml + vars: tasks: all: + deps: + - install-accounts + - install-router + - install-sessions + - install-vncache + - install-vncache-sessions + - install-users + - install-sqlite + - install-argon2-lib + - install-compression + - install-compressor-lib + cmds: - echo "Installing and configuring plugins and UI" - - task: install-accounts - - task: install-router - - task: install-sessions - - task: install-vncache - - task: install-vncache-sessions - - task: install-users - - task: install-argon2-lib - - task: install-compression - - task: install-compressor-lib - task: build-bookmarks build-bookmarks: @@ -39,7 +46,7 @@ tasks: install-accounts: cmds: #install accounts plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Plugins.Essentials.Accounts' MODULE_NAME: "Plugins.Essentials" @@ -49,7 +56,7 @@ tasks: install-router: cmds: #install router plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Plugins.Essentials.Content.Routing' MODULE_NAME: "Plugins.Essentials" @@ -59,7 +66,7 @@ tasks: install-sessions: cmds: #install sessions plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'SessionProvider' MODULE_NAME: "VNLib.Plugins.Sessions" @@ -69,7 +76,7 @@ tasks: install-users: cmds: #install users plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Plugins.Essentials.Users' MODULE_NAME: "VNLib.Plugins.Essentials.Users" @@ -79,7 +86,7 @@ tasks: install-vncache: cmds: #install vncache global cache provider plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Data.Caching.Providers.VNCache' MODULE_NAME: "VNLib.Data.Caching" @@ -89,17 +96,27 @@ tasks: install-vncache-sessions: cmds: #install vncache-web-sessions plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Plugins.Sessions.VNCache' MODULE_NAME: "VNLib.Plugins.Sessions" FILE_NAME: "release.tgz" DIR: './plugins/assets/VNLib.Plugins.Sessions.VNCache' + install-sqlite: + cmds: + #install SQLite asset package + - task: install:install + vars: + PROJECT_NAME: 'VNLib.Plugins.Extensions.Loading.Sql.SQLite' + MODULE_NAME: "VNLib.Plugins.Extensions" + FILE_NAME: "release.tgz" + DIR: './plugins/assets/VNLib.Plugins.Extensions.Loading.Sql.SQLite' + install-compression: cmds: #install compression plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'VNLib.Net.Compression' MODULE_NAME: "VNLib.Core" @@ -109,7 +126,7 @@ tasks: install-compressor-lib: cmds: #install compressor plugin - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'vnlib_compress' MODULE_NAME: "VNLib.Core" @@ -119,7 +136,7 @@ tasks: install-argon2-lib: cmds: #install the argon2 binary for Windows - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'phc-winner-argon2' MODULE_NAME: "VNLib.Core" @@ -127,7 +144,7 @@ tasks: DIR: './lib/argon2' #install the argon2 source code package for Linux and Mac - - task: install-plugin + - task: install:install vars: PROJECT_NAME: 'phc-winner-argon2' MODULE_NAME: "VNLib.Core" @@ -135,23 +152,7 @@ tasks: DIR: './lib/argon2' #remove unneeded files - - cmd: powershell -Command "rm ./lib/argon2/man -Recurse" - ignore_error: true - - cmd: powershell -Command "rm ./lib/argon2/latex -Recurse" - ignore_error: true - - cmd: powershell -Command "rm ./lib/argon2/kats -Recurse" - ignore_error: true - - cmd: powershell -Command "rm ./lib/argon2/argon2-specs.pdf" - ignore_error: true - - cmd: powershell -Command "rm ./lib/argon2/package.json" + - for: [ man, latex, kats, argon2-specs.pdf, package.json ] + cmd: powershell -Command "rm ./lib/argon2/{{.ITEM}} -Recurse" ignore_error: true - install-plugin: - cmds: - #make the plugin directory - - cmd: powershell -Command "mkdir {{.DIR}} -Force" - ignore_error: true - - cd {{.DIR}} && powershell "{{.USER_WORKING_DIR}}/install.ps1" -BaseUrl {{.BUILDS_URL}} -ModuleName {{.MODULE_NAME}} -ProjectName {{.PROJECT_NAME}} -FileName {{.FILE_NAME}} - - cd {{.DIR}} && tar -xzf {{.FILE_NAME}} - #remove the archive file - - cd {{.DIR}} && powershell -Command "rm {{.FILE_NAME}}"
\ No newline at end of file diff --git a/ci/taskfile.yaml b/ci/taskfile.yaml index e59e080..1a36e41 100644 --- a/ci/taskfile.yaml +++ b/ci/taskfile.yaml @@ -9,9 +9,16 @@ vars: BUILDS_URL: https://www.vaughnnugent.com/public/resources/software/builds includes: + install: + taskfile: install.taskfile.yaml + plugins: taskfile: plugins.taskfile.yaml + container: + dir: container #always run from the container directory + taskfile: container/Taskfile.yaml + tasks: build: @@ -27,44 +34,37 @@ tasks: - task: install-plugins - task: install-webserver + + #run container build last + - task: container:build install-webserver: cmds: - #setup env - - task: create-env - vars: - TARGET_OS: win-x64 - - - task: create-env - vars: - TARGET_OS: linux-x64 - - - task: create-env - vars: - TARGET_OS: osx-x64 - + - for: [ win-x64, linux-x64, osx-x64 ] + task: create-env + vars: + TARGET_OS: '{{.ITEM}}' postbuild_success: cmds: #make bin dir - cmd: powershell -Command "mkdir bin -Force" ignore_error: true + - for: [ win-x64, linux-x64, osx-x64 ] + task: pack + vars: + TARGET_OS: '{{.ITEM}}' - - task: pack - vars: - TARGET_OS: win-x64 - - task: pack - vars: - TARGET_OS: linux-x64 - - task: pack - vars: - TARGET_OS: osx-x64 - + - task: container:postbuild_success install-plugins: cmds: #add plugins - task: plugins:all + + build-container: + cmds: + - task: container:build create-env: vars: @@ -74,17 +74,9 @@ tasks: - cmd: powershell -Command "mkdir {{.BUILD_DIR}} -Force" ignore_error: true - #copy plugins - - cmd: powershell -Command "cp -Recurse -Force plugins {{.BUILD_DIR}}" - - #copy wwwroot - - cmd: powershell -Command "cp -Recurse -Force dist {{.BUILD_DIR}}" - - #copy libraries - - cmd: powershell -Command "cp -Recurse -Force lib {{.BUILD_DIR}}" - - #copy config - - cmd: powershell -Command "cp -Recurse -Force config {{.BUILD_DIR}}" + #copy build files + - for: [ plugins, dist, lib, config ] + cmd: powershell -Command "cp -Recurse -Force {{.ITEM}} {{.BUILD_DIR}}" - task: get-webserver vars: @@ -94,27 +86,14 @@ tasks: get-webserver: internal: true cmds: - - task: install + - task: install:install vars: PROJECT_NAME: 'VNLib.Webserver' MODULE_NAME: "VNLib.Webserver" FILE_NAME: "{{.TARGET_OS}}-release.tgz" - BUILD_DIR: '{{.BUILD_DIR}}/webserver' + DIR: '{{.BUILD_DIR}}/webserver' - cmd: powershell -Command "cp -Force ./config/config.json {{.BUILD_DIR}}/config.json" - - install: - internal: true - vars: - DIR: '"{{.BUILD_DIR}}"' - cmds: - #make the plugin directory - - cmd: powershell -Command "mkdir {{.DIR}} -Force" - ignore_error: true - - cd {{.DIR}} && powershell "{{.USER_WORKING_DIR}}/install.ps1" -BaseUrl {{.BUILDS_URL}} -ModuleName {{.MODULE_NAME}} -ProjectName {{.PROJECT_NAME}} -FileName {{.FILE_NAME}} - - cd {{.DIR}} && tar -xzf {{.FILE_NAME}} - #remove the tar file - - cd {{.DIR}} && powershell -Command "rm {{.FILE_NAME}}" pack: internal: true @@ -127,8 +106,7 @@ tasks: clean: ignore_error: true cmds: - - cmd: powershell -Command "rm -Recurse -Force ./build" - - cmd: powershell -Command "rm -Recurse -Force ./bin" - - cmd: powershell -Command "rm -Recurse -Force ./dist" - - cmd: powershell -Command "rm -Recurse -Force ./plugins" - - cmd: powershell -Command "rm -Recurse -Force ./lib"
\ No newline at end of file + - for: [ ./build, ./bin, ./dist, ./plugins, ./lib ] + cmd: powershell -Command "rm -Recurse -Force '{{.ITEM}}'" + + - task: container:clean
\ No newline at end of file |