Compare commits

...

11 Commits

Author SHA1 Message Date
Moritz 4b71066eda add wekan branding
continuous-integration/drone/push Build is passing Details
2024-05-15 14:20:21 +02:00
Moritz f8d76d082b chore: publish 2.1.1+v7.30 release
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2024-05-14 22:53:18 +02:00
Moritz 41de881966 healthcheck checks for cpu overload 2024-05-14 22:31:50 +02:00
Moritz 51b24791a4 add alakazam integration file alaconnect.yml
continuous-integration/drone/push Build is passing Details
2024-05-13 17:41:05 +02:00
iexos aa06f74560 add admin promotion to README
continuous-integration/drone/push Build is passing Details
2024-02-13 17:06:16 +01:00
moritz b1609c5ef4 Merge pull request 'chore: publish 2.1.0+v7.30 release' (#1) from simon/wekan:main into main
continuous-integration/drone/push Build is passing Details
Reviewed-on: #1
2024-01-31 12:50:53 +00:00
Simon 98d595d287 chore: publish 2.1.0+v7.30 release 2024-01-30 14:59:18 +01:00
Moritz 85c09e0fab chore: publish 2.0.0+v7.10 release
continuous-integration/drone/push Build is passing Details
2023-10-25 18:00:05 +02:00
3wc 53a08095f2 chore: publish 1.0.0+v6.99 release
continuous-integration/drone/push Build is passing Details
2023-09-23 20:46:23 +01:00
Philipp Rothmann a9181c180e chore: publish 0.14.0+v6.99 release
continuous-integration/drone/push Build is failing Details
2023-07-18 13:51:03 +02:00
Moritz bc3b7a4dba fix domain env
continuous-integration/drone/push Build is passing Details
2023-07-10 00:43:59 +02:00
7 changed files with 154 additions and 36 deletions

View File

@ -9,8 +9,8 @@ COMPOSE_FILE="compose.yml"
# Set this to run mongodb in replicaset mode (needs initialisation!)
# COMPOSE_FILE="${COMPOSE_FILE}:compose.rs.yml"
DOMAIN=board.${DOMAIN}
ROOT_URL=https://board.${DOMAIN}
DOMAIN=wekan.example.com
ROOT_URL=https://wekan.example.com
DEBUG=false
@ -26,12 +26,15 @@ RICHER_CARD_COMMENT_EDITOR=false
# PASSWORD_LOGIN_ENABLED=false
# LOGO_IMG_URL=https://authentik.example.com/static/dist/assets/icons/icon_left_brand.svg
# LOGO_LINK_URL=https://authentik.example.com
### OAUTH2 ###
OAUTH2_ENABLED=false
# OAUTH2_LOGIN_STYLE=redirect
# OAUTH2_CLIENT_ID=wekan
# OAUTH2_SERVER_URL=https://sso.${DOMAIN}
# OAUTH2_SERVER_URL=https://authentik.example.com
# OAUTH2_AUTH_ENDPOINT=/application/o/authorize/
# OAUTH2_USERINFO_ENDPOINT=/application/o/userinfo/
# OAUTH2_TOKEN_ENDPOINT=/application/o/token/

View File

@ -38,4 +38,16 @@ after mongo conaintainer came up the first time run:
```
abra app run wekan.example.org db mongo
> rs.initiate()
```
```
## Promote user to admin
If using SSO, it might happen that there is no admin user. If so, you can fix it manually in the database:
```
$ abra app run <app-name> db bash
# mongo
> use wekan
> db.users.find({'username': '<your username>'})
> db.users.updateOne({'_id': '<_id from result above>'}, {$set: {'isAdmin': true}})
```

16
abra.sh
View File

@ -1 +1,17 @@
export ENTRYPOINT_VERSION=v2
set_settings(){
mongo wekan --eval '
db.settings.updateOne(
{},
{
$set: {
"disableForgotPassword": true,
"displayAuthenticationMethod" : false,
"disableRegistration" : true,
"customTopLeftCornerLogoImageUrl": "'$LOGO_IMG_URL'",
"customTopLeftCornerLogoLinkUrl": "'$LOGO_LINK_URL'",
}
}
)'
}

20
alaconnect.yml Normal file
View File

@ -0,0 +1,20 @@
authentik:
env:
OAUTH2_ENABLED: "true"
OAUTH2_SERVER_URL: https://authentik.example.com
# TODO: set CLIENT_ID as secret
OAUTH2_CLIENT_ID: wekan
uncomment:
- OAUTH2_LOGIN_STYLE
- OAUTH2_AUTH_ENDPOINT
- OAUTH2_USERINFO_ENDPOINT
- OAUTH2_TOKEN_ENDPOINT
- OAUTH2_REQUEST_PERMISSIONS
- OAUTH2_ID_MAP
- OAUTH2_USERNAME_MAP
- OAUTH2_FULLNAME_MAP
- OAUTH2_EMAIL_MAP
- PROPAGATE_OIDC_DATA
- OIDC_REDIRECTION_ENABLED
shared_secrets:
wekan_secret: oauth2_secret

View File

@ -2,6 +2,9 @@ version: '3.8'
services:
db:
image: mongo:5.0
environment:
- LOGO_IMG_URL
- LOGO_LINK_URL
command: mongod --oplogSize 128 --quiet
volumes:
- wekan-db:/data/db
@ -21,7 +24,7 @@ services:
backupbot.backup.path: "/data/db/wekan.db"
app:
image: quay.io/wekan/wekan:v6.81
image: quay.io/wekan/wekan:v7.30
environment:
- MONGO_URL=mongodb://db:27017/wekan
- DOMAIN
@ -57,16 +60,16 @@ services:
depends_on:
- db
healthcheck:
test: node /build/healthcheck.js # no curl for healthcheck in wekan container
test: bash /build/healthcheck.sh
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
start_period: 3m
secrets:
- oauth2_secret
configs:
- source: healthcheck_js
target: /build/healthcheck.js
- source: healthcheck_sh
target: /build/healthcheck.sh
mode: 0555
- source: entrypoint
target: /home/wekan/app/docker-entrypoint.sh
@ -83,7 +86,7 @@ services:
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=0.13.2+v6.81"
- "coop-cloud.${STACK_NAME}.version=2.1.1+v7.30"
- "coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}"
volumes:
@ -95,9 +98,9 @@ networks:
internal:
configs:
healthcheck_js:
name: ${STACK_NAME}_healthcheck_js
file: healthcheck.js
healthcheck_sh:
name: ${STACK_NAME}_healthcheck_sh
file: healthcheck.sh
entrypoint:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_VERSION}
file: entrypoint.sh.tmpl

View File

@ -1,23 +0,0 @@
const http = require('http');
const options = {
host: '0.0.0.0',
port: 8080,
timeout: 2000
};
const healthCheck = http.request(options, (res) => {
console.log(`HEALTHCHECK STATUS: ${res.statusCode}`);
if (res.statusCode == 200) {
process.exit(0);
}
else {
process.exit(1);
}
});
healthCheck.on('error', function (err) {
console.error('ERROR');
process.exit(1);
});
healthCheck.end();

87
healthcheck.sh Normal file
View File

@ -0,0 +1,87 @@
#!/bin/sh
printf "GET / HTTP/1.1\n\n" > /dev/tcp/127.0.0.1/8080
if [ $? != 0 ]; then
echo "Webservice not accessible"
exit 1
fi
CPU_USAGE_THRESHOLD=100.0
PID=$(pidof node)
if [ -z "$PID" ]; then
echo "Node.js process not running."
exit 1
fi
STATE_FILE="/tmp/cpu_usage_state_$PID"
# Function to get total CPU time
get_total_cpu_time() {
cat /proc/stat | grep '^cpu ' | awk '{sum=0; for(i=2;i<=NF;i++) sum += $i; print sum;}'
}
# Function to get process CPU time
get_process_cpu_time() {
cat /proc/$PID/stat | awk '{print $14+$15}' # Only user and system time
}
# Function to get the number of CPUs
get_cpu_count() {
grep -c '^processor' /proc/cpuinfo
}
# Main script
if [ -z "$PID" ]; then
echo "Usage: $0 <pid>"
exit 1
fi
# Check if the process directory exists
if [ ! -d "/proc/$PID" ]; then
echo "Process with PID $PID does not exist."
exit 1
fi
# Get current CPU times
current_total=$(get_total_cpu_time)
current_process=$(get_process_cpu_time $PID)
# Check for previous state
if [ -f "$STATE_FILE" ]; then
# Read previous state
read prev_total prev_process < "$STATE_FILE"
# Calculate the CPU usage
delta_total=$((current_total - prev_total))
delta_process=$((current_process - prev_process))
CPU_COUNT=$(get_cpu_count)
# Normalize CPU usage across all CPUs and calculate percentage
if [ $delta_total -gt 0 ]; then # To avoid division by zero
CPU_USAGE=$(awk -v delta_process="$delta_process" -v delta_total="$delta_total" -v cpu_count="$CPU_COUNT" \
'BEGIN {printf "%.2f", (delta_process / delta_total) * 100 * cpu_count}')
awk -v usage="$CPU_USAGE" -v threshold="$CPU_USAGE_THRESHOLD" '
BEGIN {
if (usage > threshold) {
print "High CPU usage: " usage "% (Threshold: " threshold "%)";
exit 1; # Exit with status 1 for high usage
} else {
print "CPU usage within limits: " usage "%";
exit 0; # Normal exit status
}
}'
EXIT_STATUS=$?
else
echo "No enough data to calculate CPU usage. Please try again."
fi
else
echo "No previous data found. Run the script later to get CPU usage."
fi
# Save current state
echo "$current_total $current_process" > "$STATE_FILE"
if [ $EXIT_STATUS -ne 0 ]; then
echo "Exiting due to high CPU usage."
exit $EXIT_STATUS
fi