Browse Source

new: [gitlab] new charm

framadate
Valentin Lab 6 years ago
parent
commit
e90c021f7c
  1. 44
      gitlab/hooks/log_rotate-relation-joined
  2. 31
      gitlab/metadata.yml

44
gitlab/hooks/log_rotate-relation-joined

@ -0,0 +1,44 @@
#!/bin/bash
## Should be executable N time in a row with same result.
. lib/common
set -e
LOGS=/var/log
rotated_count=$(relation-get rotated-count 2>/dev/null) || true
rotated_count=${rotated_count:-52}
## No postrotate script as odoo uses a WatchedFileHandler log that
## close and reopen log file if it changes.
## XXXvlab: a lot of this intelligence should be moved away into ``logrotate`` charm
DST="$CONFIGSTORE/$TARGET_SERVICE_NAME/etc/logrotate.d/$SERVICE_NAME"
file_put "$DST" <<EOF
/var/log/docker/$SERVICE_NAME/*/*.log
{
weekly
missingok
dateext
dateyesterday
dateformat _%Y-%m-%d
extension .log
rotate $rotated_count
compress
delaycompress
notifempty
copytruncate ## important
sharedscripts
}
EOF
config-add "\
services:
$MASTER_TARGET_SERVICE_NAME:
volumes:
- $DST:/etc/logrotate.d/docker-${SERVICE_NAME}:ro
- $SERVICE_DATASTORE$LOGS:/var/log/docker/$SERVICE_NAME:rw
"

31
gitlab/metadata.yml

@ -0,0 +1,31 @@
description: "Gitlab Server"
maintainer: "Valentin Lab <valentin.lab@kalysto.org>"
## XXXvlab: docker uses the 'build' directory or the 'image:' option here.
docker-image: gitlab/gitlab-ce:latest
docker-compose:
ports:
- "5022:22"
data-resources:
- /var/opt/gitlab
- /var/log/gitlab
config-resources:
- /etc/gitlab
uses:
log-rotate:
#constraint: required | recommended | optional
#auto: pair | summon | none ## default: pair
constraint: recommended
auto: pair
solves:
disk-leak: "/var/log/gitlab"
web-proxy:
#constraint: required | recommended | optional
#auto: pair | summon | none ## default: pair
constraint: recommended
auto: pair
solves:
proxy: "Public access"
default-options:
target: !var-expand ${MASTER_BASE_SERVICE_NAME}:80
Loading…
Cancel
Save