Files
chef/site-cookbooks/kosmos-ejabberd/kitchen.yml
T

79 lines
3.0 KiB
YAML

---
driver:
name: dokken
chef_version: 18.2.7
pull_platform_image: false
pull_chef_image: false
memory_limit: 2147483648 # 2GB
volumes:
# saves the apt archives outside of the container
- /var/cache/apt/archives/:/var/cache/apt/archives/
transport:
name: dokken
provisioner:
name: dokken
client_rb:
# the ejabberd package starts its service as ejabberd@localhost during
# installation; keep the chef node name in sync so ERLANG_NODE matches
node_name: localhost
# skip the firewall recipe, which is not wanted inside the container
environment: development
verifier:
name: inspec
# prepare the backing services the recipe expects in production: a PostgreSQL
# server reachable as pg.kosmos.local, trusting local connections, with the
# databases used by the vhosts
lifecycle:
pre_converge:
- remote: |
bash -c '
set -e
grep -q pg.kosmos.local /etc/hosts || echo 127.0.0.1 pg.kosmos.local >> /etc/hosts
systemctl start postgresql
HBA=$(ls /etc/postgresql/*/main/pg_hba.conf | head -1)
grep -q "127.0.0.1/32 trust" "$HBA" || sed -i "1i host all all 127.0.0.1/32 trust" "$HBA"
systemctl reload postgresql
sudo -u postgres psql -c "CREATE ROLE ejabberd LOGIN CREATEDB" 2>/dev/null || true
sudo -u postgres createdb -O ejabberd ejabberd 2>/dev/null || true
sudo -u postgres createdb -O ejabberd ejabberd_5apps 2>/dev/null || true
'
platforms:
- name: ubuntu-24.04
driver:
image: dokken/ubuntu-24.04
privileged: true
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
# prevent APT from deleting the APT folder
- RUN rm /etc/apt/apt.conf.d/docker-clean
# let packages start their services during installation, like on a real
# node (dokken images ship policy-rc.d that blocks service starts)
- RUN rm -f /usr/sbin/policy-rc.d
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql
# provide the TLS material the ejabberd config expects: dhparams.pem is
# generated manually on real nodes, the certs are deployed by the
# letsencrypt recipe (not exercised in this suite)
- RUN mkdir -p /opt/ejabberd/conf && openssl dhparam -out /opt/ejabberd/conf/dhparams.pem 1024 && (for d in kosmos.org kosmos.chat 5apps.com; do openssl req -x509 -newkey rsa:2048 -nodes -days 3650 -subj "/CN=$d" -keyout /opt/ejabberd/conf/$d.key -out /opt/ejabberd/conf/$d.crt; done)
suites:
- name: default
data_bags_path: "test/integration/default/data_bags"
encrypted_data_bag_secret_key_path: "test/integration/default/encrypted_data_bag_secret"
run_list:
- recipe[kosmos-ejabberd::default]
verifier:
inspec_tests:
- test/integration/default
attributes:
# normally provided by knife-zero / the garage role on real nodes
knife_zero:
host: "127.0.0.1"
garage:
xmpp_upload_bucket: "kosmos-xmpp-uploads"
s3_api_root_domain: "s3.kosmos.org"