Browse Source

new: [radicale] add new charm.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
element
Valentin Lab 2 years ago
parent
commit
637b665b50
  1. 22
      radicale/build/Dockerfile
  2. 7
      radicale/build/README
  3. 28
      radicale/build/default.nix
  4. 8
      radicale/hooks/init

22
radicale/build/Dockerfile

@ -1,21 +1,5 @@
FROM debian:jessie
FROM alpine:3.15
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apk add radicale
RUN pip3 install --upgrade radicale
## XXXvlab: TO REMOVE, Ugh, git is needed only to install radicale_auth_ldap
## XXXvlab: This should be installed only if we link to ldap
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y git --no-install-recommends && \
cd /tmp && git clone https://github.com/marcoh00/radicale-auth-ldap && \
cd radicale-auth-ldap && python3 setup.py install && \
cd .. && rm -rf radicale-auth-ldap && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENTRYPOINT [ "radicale" ]
ENTRYPOINT [ "radicale", "--storage-filesystem-folder=/var/lib/radicale/collections" ]

7
radicale/build/README

@ -1,7 +0,0 @@
To use nix for building this image:
nix-build .
it'll give a file "result" that you can load in docker:
docker load < result

28
radicale/build/default.nix

@ -1,28 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
# entrypoint = writeScript "entrypoint.sh" ''
# #!${stdenv.shell}
# set -e
# exec "$@"
# '';
in
dockerTools.buildImage {
name = "radicale";
runAsRoot = ''
#!${stdenv.shell}
${dockerTools.shadowSetup}
'';
contents = [ radicale ];
config = {
# Cmd = [ "radicale" ];
Entrypoint = [ "radicale" ];
ExposedPorts = {
"6379/tcp" = {};
};
WorkingDir = "/data";
};
}

8
radicale/hooks/init

@ -15,13 +15,15 @@ set -u
service_def=$(get_compose_service_def "$SERVICE_NAME") service_def=$(get_compose_service_def "$SERVICE_NAME")
CONF="$SERVICE_CONFIGSTORE/etc/radicale/config"
CONFIG_PATH="/etc/radicale/config"
HOST_CONFIG_PATH="$SERVICE_CONFIGSTORE$CONFIG_PATH"
config=$(echo "$service_def" | shyaml get-value options.config 2>/dev/null) || { config=$(echo "$service_def" | shyaml get-value options.config 2>/dev/null) || {
die "Missing ${WHITE}config${NORMAL} option." die "Missing ${WHITE}config${NORMAL} option."
} }
file_put "$CONF" <<EOF
mkdir -p "${HOST_CONFIG_PATH%/*}"
file_put "$HOST_CONFIG_PATH" <<EOF || exit 1
$config $config
[server] [server]
@ -32,7 +34,7 @@ EOF
init-config-add "\ init-config-add "\
$SERVICE_NAME: $SERVICE_NAME:
environment: environment:
RADICALE_CONFIG: \"$CONF\"
RADICALE_CONFIG: \"$CONFIG_PATH\"
" "
Loading…
Cancel
Save