From 0bccbffd809015a9ee2e3aca690f68d47ca34c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20M=C3=BCtsch?= Date: Wed, 28 Apr 2021 22:20:25 +0200 Subject: [PATCH] chore: quick run script fix: run in production mode by default --- config.default.yml | 56 +++++++++++++++--------------- scripts/config.yml | 12 +++++++ scripts/get.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 28 deletions(-) create mode 100644 scripts/config.yml create mode 100644 scripts/get.sh diff --git a/config.default.yml b/config.default.yml index 36aae94..6a8d5d4 100644 --- a/config.default.yml +++ b/config.default.yml @@ -1,58 +1,58 @@ -env: development +env: production server: - listen_ipv4: 127.0.0.1 # leave blank to disable ipv4 - listen_ipv6: ::1 # leave blank to disable ipv6 - tls_cert_path: # leave blank to not use https - tls_key_path: # leave blank to not use https + listen_ipv4: 127.0.0.1 # leave blank to disable ipv4 + listen_ipv6: ::1 # leave blank to disable ipv6 + tls_cert_path: # leave blank to not use https + tls_key_path: # leave blank to not use https port: 3000 base_path: / - public_url: http://localhost:3000 # required for links (e.g. password reset) in e-mail + public_url: http://localhost:3000 # required for links (e.g. password reset) in e-mail app: - aggregation_time: '02:15' # time at which to run daily aggregation batch jobs - inactive_days: 7 # time of previous days within a user must have logged in to be considered active + aggregation_time: '02:15' # time at which to run daily aggregation batch jobs + inactive_days: 7 # time of previous days within a user must have logged in to be considered active custom_languages: vue: Vue jsx: JSX svelte: Svelte db: - host: # leave blank when using sqlite3 - port: # leave blank when using sqlite3 - user: # leave blank when using sqlite3 - password: # leave blank when using sqlite3 - name: wakapi_db.db # database name for mysql / postgres or file path for sqlite (e.g. /tmp/wakapi.db) - dialect: sqlite3 # mysql, postgres, sqlite3 - charset: utf8mb4 # only used for mysql connections - max_conn: 2 # maximum number of concurrent connections to maintain - ssl: false # whether to use tls for db connection (must be true for cockroachdb) (ignored for mysql and sqlite) - automgirate_fail_silently: false # whether to ignore schema auto-migration failures when starting up + host: # leave blank when using sqlite3 + port: # leave blank when using sqlite3 + user: # leave blank when using sqlite3 + password: # leave blank when using sqlite3 + name: wakapi_db.db # database name for mysql / postgres or file path for sqlite (e.g. /tmp/wakapi.db) + dialect: sqlite3 # mysql, postgres, sqlite3 + charset: utf8mb4 # only used for mysql connections + max_conn: 2 # maximum number of concurrent connections to maintain + ssl: false # whether to use tls for db connection (must be true for cockroachdb) (ignored for mysql and sqlite) + automgirate_fail_silently: false # whether to ignore schema auto-migration failures when starting up security: - password_salt: # CHANGE ! - insecure_cookies: false # You need to set this to 'true' when on localhost + password_salt: # change this + insecure_cookies: true # should be set to 'false', except when not running with HTTPS (e.g. on localhost) cookie_max_age: 172800 allow_signup: true expose_metrics: false sentry: - dsn: # leave blank to disable sentry integration - enable_tracing: true # whether to use performance monitoring - sample_rate: 0.75 # probability of tracing a request - sample_rate_heartbeats: 0.1 # probability of tracing a heartbeat request + dsn: # leave blank to disable sentry integration + enable_tracing: true # whether to use performance monitoring + sample_rate: 0.75 # probability of tracing a request + sample_rate_heartbeats: 0.1 # probability of tracing a heartbeat request mail: - enabled: true # whether to enable mails (used for password resets, reports, etc.) - provider: smtp # method for sending mails, currently one of ['smtp', 'mailwhale'] - smtp: # smtp settings when sending mails via smtp + enabled: true # whether to enable mails (used for password resets, reports, etc.) + provider: smtp # method for sending mails, currently one of ['smtp', 'mailwhale'] +smtp: # smtp settings when sending mails via smtp host: port: username: password: tls: sender: Wakapi - mailwhale: # mailwhale.dev settings when using mailwhale as sending service + mailwhale: # mailwhale.dev settings when using mailwhale as sending service url: client_id: client_secret: diff --git a/scripts/config.yml b/scripts/config.yml new file mode 100644 index 0000000..671d14c --- /dev/null +++ b/scripts/config.yml @@ -0,0 +1,12 @@ +# SQLite +source: + name: ../wakapi_db.db + +# MySQL +target: + host: localhost + port: 5432 + user: wakapi_user + password: wakapi + name: wakapi_local + dialect: \ No newline at end of file diff --git a/scripts/get.sh b/scripts/get.sh new file mode 100644 index 0000000..bb957ca --- /dev/null +++ b/scripts/get.sh @@ -0,0 +1,86 @@ +#!/bin/sh + +# This script installs Wakapi. +# +# Quick install: `curl https://wakapi.dev/get | bash` +# +# This script will install Wakapi to the directory you're in. To install +# somewhere else (e.g. /usr/local/bin), cd there and make sure you can write to +# that directory, e.g. `cd /usr/local/bin; curl https://wakapi.dev/get | sudo bash` +# +# Acknowledgments: +# - Micro Editor for this script: https://micro-editor.github.io/ +# - ASCII art courtesy of figlet: http://www.figlet.org/ + +set -e -u + +githubLatestTag() { + finalUrl=$(curl "https://github.com/$1/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}') + printf "%s\n" "${finalUrl##*/}" +} + +platform='' +machine=$(uname -m) # currently, Wakapi builds are only available for AMD64 anyway + +if [ "${GETWAKAPI_PLATFORM:-x}" != "x" ]; then + platform="$GETWAKAPI_PLATFORM" +else + case "$(uname -s | tr '[:upper:]' '[:lower:]')" in + "linux") platform='linux_amd64' ;; + "msys"*|"cygwin"*|"mingw"*|*"_nt"*|"win"*) platform='win_amd64' ;; + esac +fi + +if [ "x$platform" = "x" ]; then + cat << 'EOM' +/=====================================\\ +| COULD NOT DETECT PLATFORM | +\\=====================================/ + +Uh oh! We couldn't automatically detect your operating system. You can file a +bug here: https://github.com/muety/wakapi +EOM + exit 1 +else + printf "Detected platform: %s\n" "$platform" +fi + +TAG=$(githubLatestTag muety/wakapi) + +printf "Tag: %s" "$TAG" + +extension='zip' + +printf "Latest Version: %s\n" "$TAG" +printf "Downloading https://github.com/muety/wakapi/releases/download/%s/wakapi_%s.%s\n" "$TAG" "$platform" "$extension" + +curl -L "https://github.com/muety/wakapi/releases/download/$TAG/wakapi_$platform.$extension" > "wakapi.$extension" + +case "$extension" in + "zip") unzip -j "wakapi.$extension" -d "wakapi-$TAG" ;; + "tar.gz") tar -xvzf "wakapi.$extension" "wakapi-$TAG/wakapi" ;; +esac + +mv "wakapi-$TAG/wakapi" ./wakapi +mv "wakapi-$TAG/config.yml" ./config.yml + +rm "wakapi.$extension" +rm -rf "wakapi-$TAG" + +cat <<-'EOM' + +__ __ _ _ +\ \ / /_ _| | ____ _ _ __ (_) + \ \ /\ / / _` | |/ / _` | '_ \| | + \ V V / (_| | < (_| | |_) | | + \_/\_/ \__,_|_|\_\__,_| .__/|_| + |_| + +Wakapi has been downloaded to the current directory. +You can run it with: + +./wakapi + +For further instructions see https://github.com/muety/wakapi + +EOM