Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to Radicale 3.2.0 #147

Merged
merged 7 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [3.2.0.0] - 2024-05-13

## Changed

- [Update to Radicale 3.2.0](https://github.com/tomsquest/docker-radicale/pull/147)


## [3.1.9.1] - 2024-03-18

## Changed
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG COMMIT_ID
ENV COMMIT_ID ${COMMIT_ID}

ARG VERSION
ENV VERSION ${VERSION:-3.1.9}
ENV VERSION ${VERSION:-3.2.0}

ARG BUILD_UID
ENV BUILD_UID ${BUILD_UID:-2999}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ To run the tests:

1. `pip install pipenv`
2. `pipenv install -d`
3. `pytest -v`
3. `pipenv run pytest -v`

## Releasing

Expand Down
26 changes: 21 additions & 5 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
# CalDAV server hostnames separated by a comma
# IPv4 syntax: address:port
# IPv6 syntax: [address]:port
# For example: 0.0.0.0:9999, [::]:9999
# Hostname syntax (using "getaddrinfo" to resolve to IPv4/IPv6 adress(es)): hostname:port
# For example: 0.0.0.0:9999, [::]:9999, localhost:9999
#hosts = localhost:5232
hosts = 0.0.0.0:5232

Expand Down Expand Up @@ -60,8 +61,8 @@ hosts = 0.0.0.0:5232
#htpasswd_filename = /etc/radicale/users

# Htpasswd encryption method
# Value: plain | bcrypt | md5
# bcrypt requires the installation of radicale[bcrypt].
# Value: plain | bcrypt | md5 | sha256 | sha512 | autodetect
# bcrypt requires the installation of 'bcrypt' module.
#htpasswd_encryption = md5

# Incorrect authentication delay (seconds)
Expand All @@ -70,6 +71,9 @@ hosts = 0.0.0.0:5232
# Message displayed in the client when a password is needed
#realm = Radicale - Password Required

# Сonvert username to lowercase, must be true for case-insensitive auth providers
#lc_username = False


[rights]

Expand All @@ -80,6 +84,9 @@ hosts = 0.0.0.0:5232
# File for rights management from_file
#file = /etc/radicale/rights

# Permit delete of a collection (global)
#permit_delete_collection = True


[storage]

Expand All @@ -95,7 +102,7 @@ filesystem_folder = /data/collections
#max_sync_token_age = 2592000

# Command that is run after changes to storage
# Example: ([ -d .git ] || git init) && git add -A && (git diff --cached --quiet || git commit -m "Changes by "%(user)s)
# Example: ([ -d .git ] || git init) && git add -A && (git diff --cached --quiet || git commit -m "Changes by \"%(user)s\"")
#hook =


Expand All @@ -110,7 +117,7 @@ filesystem_folder = /data/collections

# Threshold for the logger
# Value: debug | info | warning | error | critical
#level = warning
#level = info

# Don't include passwords in logs
#mask_passwords = True
Expand All @@ -120,3 +127,12 @@ filesystem_folder = /data/collections

# Additional HTTP headers
#Access-Control-Allow-Origin = *

[hook]

# Hook types
# Value: none | rabbitmq
#type = none
#rabbitmq_endpoint =
#rabbitmq_topic =
#rabbitmq_queue_type = classic
58 changes: 38 additions & 20 deletions test_image_custom_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,61 @@
import subprocess
import testinfra

@pytest.fixture(scope='session')

@pytest.fixture(scope="session")
def host():
subprocess.check_call(
['docker', 'build', '-t', 'radicale-under-test',
'--build-arg', 'VERSION=3.0.0',
'--build-arg', 'BUILD_UID=6666',
'--build-arg', 'BUILD_GID=7777',
'.'
])
docker_id = subprocess.check_output(['docker', 'run', '-d', 'radicale-under-test']).decode().strip()
[
"docker",
"build",
"-t",
"radicale-under-test",
"--build-arg",
"VERSION=3.2.0",
"--build-arg",
"BUILD_UID=6666",
"--build-arg",
"BUILD_GID=7777",
".",
]
)

Check notice on line 22 in test_image_custom_build.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_custom_build.py#L8-L22

Starting a process with a partial executable path (B607)
docker_id = (
subprocess.check_output(["docker", "run", "-d", "radicale-under-test"])

Check notice on line 24 in test_image_custom_build.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_custom_build.py#L24

Starting a process with a partial executable path (B607)
.decode()
.strip()
)

yield testinfra.get_host("docker://" + docker_id)

# teardown
subprocess.check_call(['docker', 'rm', '-f', docker_id])
subprocess.check_call(["docker", "rm", "-f", docker_id])

Check notice on line 32 in test_image_custom_build.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_custom_build.py#L32

Starting a process with a partial executable path (B607)


def test_process(host):
process = host.process.get(comm='radicale')
process = host.process.get(comm="radicale")
assert process.pid == 1
assert process.user == 'radicale'
assert process.group == 'radicale'
assert process.user == "radicale"
assert process.group == "radicale"


def test_port(host):
assert host.socket('tcp://0.0.0.0:5232').is_listening
assert host.socket("tcp://0.0.0.0:5232").is_listening


def test_version(host):
assert host.check_output('/venv/bin/radicale --version') == '3.0.0'
assert host.check_output("/venv/bin/radicale --version") == "3.2.0"


def test_user(host):
user = 'radicale'
user = "radicale"
assert host.user(user).uid == 6666
assert host.user(user).gid == 7777
assert host.user(user).shell == '/bin/false'
assert 'radicale L ' in host.check_output('passwd --status radicale')
assert host.user(user).shell == "/bin/false"
assert "radicale L " in host.check_output("passwd --status radicale")


def test_data_folder_writable(host):
folder = '/data'
assert host.file(folder).user == 'radicale'
assert host.file(folder).group == 'radicale'
folder = "/data"
assert host.file(folder).user == "radicale"
assert host.file(folder).group == "radicale"
assert host.file(folder).mode == 0o770
73 changes: 41 additions & 32 deletions test_image_prod.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,69 @@
import subprocess

import pytest
import subprocess
import testinfra


@pytest.fixture(scope='session')
@pytest.fixture(scope="session")
def host():
subprocess.check_call(['docker', 'build', '-t', 'radicale-under-test', '.'])
docker_id = subprocess.check_output([
'docker', 'run', '-d',
'--init',
'--read-only',
'--security-opt=no-new-privileges:true',
# Not able to use cap-drop=all and make the container start
# '--cap-drop', 'ALL',
# '--cap-add', 'SYS_ADMIN',
# '--cap-add', 'CHOWN',
# '--cap-add', 'SETUID',
# '--cap-add', 'SETGID',
# '--cap-add', 'KILL',
'--pids-limit', '50',
'--memory', '256M',
'radicale-under-test'
]).decode().strip()
subprocess.check_call(["docker", "build", "-t", "radicale-under-test", "."])

Check notice on line 8 in test_image_prod.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_prod.py#L8

Starting a process with a partial executable path (B607)
docker_id = (
subprocess.check_output(
[
"docker",
"run",
"-d",
"--init",
"--read-only",
"--security-opt=no-new-privileges:true",
# Not able to use cap-drop=all and make the container start
# '--cap-drop', 'ALL',
# '--cap-add', 'SYS_ADMIN',
# '--cap-add', 'CHOWN',
# '--cap-add', 'SETUID',
# '--cap-add', 'SETGID',
# '--cap-add', 'KILL',
"--pids-limit",
"50",
"--memory",
"256M",
"radicale-under-test",
]
)

Check notice on line 31 in test_image_prod.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_prod.py#L10-L31

Starting a process with a partial executable path (B607)
.decode()
.strip()
)

yield testinfra.get_host("docker://" + docker_id)

# teardown
subprocess.check_call(['docker', 'rm', '-f', docker_id])
subprocess.check_call(["docker", "rm", "-f", docker_id])

Check notice on line 39 in test_image_prod.py

View check run for this annotation

codefactor.io / CodeFactor

test_image_prod.py#L39

Starting a process with a partial executable path (B607)


def test_process(host):
process = host.process.get(comm='radicale')
process = host.process.get(comm="radicale")
assert process.pid != 1
assert process.user == 'radicale'
assert process.group == 'radicale'
assert process.user == "radicale"
assert process.group == "radicale"


def test_port(host):
assert host.socket('tcp://0.0.0.0:5232').is_listening
assert host.socket("tcp://0.0.0.0:5232").is_listening


def test_version(host):
assert host.check_output('/venv/bin/radicale --version') == '3.1.9'
assert host.check_output("/venv/bin/radicale --version") == "3.2.0"


def test_user(host):
user = 'radicale'
user = "radicale"
assert host.user(user).uid == 2999
assert host.user(user).gid == 2999
assert host.user(user).shell == '/bin/false'
assert 'radicale L ' in host.check_output('passwd --status radicale')
assert host.user(user).shell == "/bin/false"
assert "radicale L " in host.check_output("passwd --status radicale")


def test_data_folder_writable(host):
folder = '/data'
assert host.file(folder).user == 'radicale'
assert host.file(folder).group == 'radicale'
folder = "/data"
assert host.file(folder).user == "radicale"
assert host.file(folder).group == "radicale"
assert host.file(folder).mode == 0o770
Loading