feat: add basic httpbin services

Used to test connectivity of proxies
This commit is contained in:
Bert-Jan Fikse 2025-11-07 11:50:53 +01:00
parent 8c29be5db7
commit a4aa64777e
Signed by: bert-jan
GPG key ID: C1E0AB516AC16D1A
18 changed files with 346 additions and 0 deletions

9
.idea/digitalboard.core.iml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="reference-ansible" />
</component>
</module>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

12
.idea/material_theme_project_new.xml generated Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="6727a2ce:1988652562a:-7ffe" />
</MTProjectMetadataState>
</option>
</component>
</project>

7
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.13" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13" project-jdk-type="Python SDK" />
</project>

9
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/digitalboard.core.iml" filepath="$PROJECT_DIR$/.idea/digitalboard.core.iml" />
<module fileurl="file://$PROJECT_DIR$/../reference-ansible/.idea/reference-ansible.iml" filepath="$PROJECT_DIR$/../reference-ansible/.idea/reference-ansible.iml" />
</modules>
</component>
</project>

8
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../reference-ansible" vcs="Git" />
</component>
</project>

93
notes-nextcloud Normal file
View file

@ -0,0 +1,93 @@
version: "3.9"
# ⛵ Nextcloud + Collabora (CODE) behind Traefik (TLS at Traefik)
# Replace all occurrences of cloud.digitalboard.ch and office.example.com with your domains.
services:
db:
image: postgres:16-alpine
container_name: nextcloud-postgres
restart: always
environment:
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: PVgvn5w06yvN7K8QwKacLrGNtvQformw
volumes:
- /srv/data/nextcloud/postgresql/data:/var/lib/postgresql/data
networks:
- internal
redis:
image: redis:7-alpine
container_name: nextcloud-redis
restart: always
command: ["redis-server", "--appendonly", "yes"]
volumes:
- /srv/data/nextcloud/redis/data:/data
networks:
- internal
nextcloud:
image: nextcloud:apache
container_name: nextcloud
restart: always
depends_on:
- db
- redis
environment:
POSTGRES_HOST: db
POSTGRES_DB: nextcloud
POSTGRES_USER: nextcloud
POSTGRES_PASSWORD: PVgvn5w06yvN7K8QwKacLrGNtvQformw
NEXTCLOUD_ADMIN_USER: tinfoil
NEXTCLOUD_ADMIN_PASSWORD: Wkcox8ZD05po1rq60Y4h2cIenws7hF7F
REDIS_HOST: redis
# REDIS_HOST_PASSWORD: ""
PHP_MEMORY_LIMIT: 1024M
PHP_UPLOAD_LIMIT: 2048M
OVERWRITEPROTOCOL: https
OVERWRITEHOST: cloud.digitalboard.ch
TRUSTED_PROXIES: "172.18.0.0/16"
volumes:
- /srv/data/nextcloud/nextcloud/:/var/www/html
- ./servername.conf:/etc/apache2/conf-enabled/servername.conf
networks:
- internal
- proxy
labels:
- traefik.enable=true
- traefik.docker.network=proxy
- traefik.http.routers.nextcloud.rule=Host(`cloud.digitalboard.ch`)
- traefik.http.routers.nextcloud.entrypoints=web
- traefik.http.services.nextcloud.loadbalancer.server.port=80
# Ensure Nextcloud always sees HTTPS from the double proxy:
- traefik.http.middlewares.nc-https.headers.customrequestheaders.X-Forwarded-Proto=https
- traefik.http.routers.nextcloud.middlewares=nc-wellknown,nc-https
# Well-known DAV:
- traefik.http.middlewares.nc-wellknown.redirectregex.permanent=true
- traefik.http.middlewares.nc-wellknown.redirectregex.regex=^https?://([^/]+)/.well-known/(card|cal)dav
- traefik.http.middlewares.nc-wellknown.redirectregex.replacement=https://$${1}/remote.php/dav/
collabora:
image: collabora/code:latest
container_name: collabora
restart: always
environment:
domain: ^cloud\.example\.com$
extra_params: --o:ssl.enable=false --o:ssl.termination=true
username: admin
password: change_me
cap_add:
- MKNOD
networks:
- proxy
labels:
- traefik.enable=true
- traefik.http.routers.collabora.rule=Host(`office-intern.example.com`)
- traefik.http.routers.collabora.entrypoints=web
- traefik.http.services.collabora.loadbalancer.server.port=9980
networks:
internal:
proxy:
external: true

38
roles/httpbin/README.md Normal file
View file

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View file

@ -0,0 +1,19 @@
#SPDX-License-Identifier: MIT-0
---
# defaults file for httpbin
# Base directory configuration (inherited from base role or defined here)
docker_compose_base_dir: /etc/docker/compose
# Httpbin-specific configuration
httpbin_service_name: httpbin
httpbin_docker_compose_dir: "{{ docker_compose_base_dir }}/{{ httpbin_service_name }}"
# Service configuration
httpbin_domain: "httpbin.local.test"
httpbin_image: "kennethreitz/httpbin"
httpbin_port: 80
# Traefik configuration
httpbin_traefik_network: "proxy"
httpbin_use_ssl: true

View file

@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# handlers file for httpbin

View file

@ -0,0 +1,35 @@
#SPDX-License-Identifier: MIT-0
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View file

@ -0,0 +1,20 @@
#SPDX-License-Identifier: MIT-0
---
# tasks file for httpbin
- name: Create docker compose directory
file:
path: "{{ httpbin_docker_compose_dir }}"
state: directory
mode: '0755'
- name: Create docker-compose file for httpbin
template:
src: docker-compose.yml.j2
dest: "{{ httpbin_docker_compose_dir }}/docker-compose.yml"
mode: '0644'
- name: Start httpbin container
community.docker.docker_compose_v2:
project_src: "{{ httpbin_docker_compose_dir }}"
state: present

View file

@ -0,0 +1,22 @@
services:
httpbin:
image: {{ httpbin_image }}
container_name: {{ httpbin_service_name }}
restart: unless-stopped
networks:
- {{ httpbin_traefik_network }}
labels:
- traefik.enable=true
- traefik.docker.network={{ httpbin_traefik_network }}
- traefik.http.routers.{{ httpbin_service_name }}.rule=Host(`{{ httpbin_domain }}`)
{% if httpbin_use_ssl %}
- traefik.http.routers.{{ httpbin_service_name }}.entrypoints=websecure
- traefik.http.routers.{{ httpbin_service_name }}.tls=true
{% else %}
- traefik.http.routers.{{ httpbin_service_name }}.entrypoints=web
{% endif %}
- traefik.http.services.{{ httpbin_service_name }}.loadbalancer.server.port={{ httpbin_port }}
networks:
{{ httpbin_traefik_network }}:
external: true

View file

@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
localhost

View file

@ -0,0 +1,6 @@
#SPDX-License-Identifier: MIT-0
---
- hosts: localhost
remote_user: root
roles:
- httpbin

View file

@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# vars file for httpbin

View file

@ -0,0 +1,47 @@
{% if enable_dashboard %}
api:
dashboard: true
insecure: true
{% endif %}
{% if enable_access_logs %}
accessLog:
format: {{ access_log_format }}
{% endif %}
entryPoints:
web:
address: ":80"
{% if use_ssl %}
http:
redirections:
entryPoint:
to: websecure
scheme: https
{% endif %}
websecure:
address: ":443"
providers:
{% if use_static_services | default(false) %}
file:
filename: /etc/traefik/services.yml
watch: true
{% endif %}
{% if use_docker_provider | default(true) %}
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
{% endif %}
certificatesResolvers:
letsencrypt:
acme:
email: admin@digitalboard.ch
storage: /letsencrypt/acme.json
httpChallenge:
entryPoint: web
global:
checkNewVersion: false
sendAnonymousUsage: false