Initial commit

This commit is contained in:
2026-09-01 09:38:11 -04:00
commit 342e920a4c
18 changed files with 550 additions and 0 deletions
+38
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).
+41
View File
@@ -0,0 +1,41 @@
#SPDX-License-Identifier: MIT-0
---
# defaults file for ansible-role-wanderer
wanderer_namespace: wanderer
wanderer_images:
search: getmeili/meilisearch:v1.36.0
db: flomp/wanderer-db:latest
web: flomp/wanderer-web:latest
wanderer_replica_count:
search: 1
db: 1
web: 1
wanderer_service_type: ClusterIP
wanderer_web_service_type: ClusterIP
wanderer_search_service_type: ClusterIP
wanderer_db_service_type: ClusterIP
wanderer_storage_class_name: ""
wanderer_storage:
search: 5Gi
db: 5Gi
uploads: 5Gi
wanderer_env:
meili_master_key: "vODkljPcfFANYNepCHyDyGjzAMPcdHnrb6X5KyXQPWo"
pocketbase_encryption_key: "fde406459dc1f6ca6f348e1f44a9a2af"
origin: "http://localhost:3000"
public_disable_signup: "false"
body_size_limit: "Infinity"
overpass_api_url: "https://overpass-api.de"
valhalla_url: "https://valhalla1.openstreetmap.de"
nominatim_url: "https://nominatim.openstreetmap.org"
public_map_max_polylines: "100"
wanderer_upload_user: ""
wanderer_upload_password: ""
wanderer_host: wanderer.example.com
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# handlers file for ansible-role-wanderer
+35
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.
+89
View File
@@ -0,0 +1,89 @@
#SPDX-License-Identifier: MIT-0
---
# tasks file for ansible-role-wanderer
- name: Create namespace
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'namespace.yaml.j2') | from_yaml }}"
- name: Create secret
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'secret.yaml.j2') | from_yaml }}"
- name: Create configmap
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'configmap.yaml.j2') | from_yaml }}"
- name: Create search PVC
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wanderer-search-data
namespace: "{{ wanderer_namespace }}"
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "{{ wanderer_storage.search }}"
{% if wanderer_storage_class_name | length > 0 %}
storageClassName: "{{ wanderer_storage_class_name }}"
{% endif %}
- name: Create uploads PVC
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wanderer-web-uploads
namespace: "{{ wanderer_namespace }}"
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: "{{ wanderer_storage.uploads }}"
{% if wanderer_storage_class_name | length > 0 %}
storageClassName: "{{ wanderer_storage_class_name }}"
{% endif %}
- name: Deploy search
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'search-deployment.yaml.j2') | from_yaml }}"
- name: Expose search
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'search-service.yaml.j2') | from_yaml }}"
- name: Deploy db
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'db-deployment.yaml.j2') | from_yaml }}"
- name: Expose db
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'db-service.yaml.j2') | from_yaml }}"
- name: Deploy web
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'web-deployment.yaml.j2') | from_yaml }}"
- name: Expose web
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'web-service.yaml.j2') | from_yaml }}"
- name: Create ingress
kubernetes.core.k8s:
state: present
definition: "{{ lookup('template', 'ingress.yaml.j2') | from_yaml }}"
+17
View File
@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: wanderer-config
namespace: {{ wanderer_namespace }}
data:
MEILI_URL: "http://search:7700"
ORIGIN: "{{ wanderer_env.origin }}"
BODY_SIZE_LIMIT: "{{ wanderer_env.body_size_limit }}"
PUBLIC_POCKETBASE_URL: "http://db:8090"
PUBLIC_DISABLE_SIGNUP: "{{ wanderer_env.public_disable_signup }}"
UPLOAD_FOLDER: "/app/uploads"
OVERPASS_API_URL: "{{ wanderer_env.overpass_api_url }}"
VALHALLA_URL: "{{ wanderer_env.valhalla_url }}"
NOMINATIM_URL: "{{ wanderer_env.nominatim_url }}"
PUBLIC_MAP_MAX_POLYLINES: "{{ wanderer_env.public_map_max_polylines }}"
+70
View File
@@ -0,0 +1,70 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: db
namespace: {{ wanderer_namespace }}
spec:
replicas: {{ wanderer_replica_count.db }}
selector:
matchLabels:
app: db
template:
metadata:
labels:
app: db
spec:
containers:
- name: db
image: "{{ wanderer_images.db }}"
ports:
- containerPort: 8090
env:
- name: MEILI_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: MEILI_URL
- name: MEILI_MASTER_KEY
valueFrom:
secretKeyRef:
name: wanderer-secrets
key: MEILI_MASTER_KEY
- name: POCKETBASE_ENCRYPTION_KEY
valueFrom:
secretKeyRef:
name: wanderer-secrets
key: POCKETBASE_ENCRYPTION_KEY
- name: ORIGIN
valueFrom:
configMapKeyRef:
name: wanderer-config
key: ORIGIN
volumeMounts:
- name: pb-data
mountPath: /pb_data
- name: plugins
mountPath: /data/plugins
readinessProbe:
httpGet:
path: /health
port: 8090
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
livenessProbe:
httpGet:
path: /health
port: 8090
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
volumes:
- name: pb-data
persistentVolumeClaim:
claimName: wanderer-db-data
- name: plugins
persistentVolumeClaim:
claimName: wanderer-db-plugins
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: db
namespace: {{ wanderer_namespace }}
spec:
type: {{ wanderer_db_service_type }}
selector:
app: db
ports:
- port: 8090
targetPort: 8090
protocol: TCP
+27
View File
@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: wanderer
namespace: {{ wanderer_namespace }}
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: ca-issuer
nginx.ingress.kubernetes.io/proxy-body-size: "50m"
spec:
ingressClassName: nginx
tls:
- hosts:
- {{ wanderer_host }}
secretName: wanderer-tls
rules:
- host: {{ wanderer_host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 3000
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ wanderer_namespace }}
+57
View File
@@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: search
namespace: {{ wanderer_namespace }}
spec:
replicas: {{ wanderer_replica_count.search }}
selector:
matchLabels:
app: search
template:
metadata:
labels:
app: search
spec:
containers:
- name: search
image: "{{ wanderer_images.search }}"
ports:
- containerPort: 7700
env:
- name: MEILI_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: MEILI_URL
- name: MEILI_MASTER_KEY
valueFrom:
secretKeyRef:
name: wanderer-secrets
key: MEILI_MASTER_KEY
- name: MEILI_NO_ANALYTICS
value: "true"
volumeMounts:
- name: search-data
mountPath: /meili_data
readinessProbe:
httpGet:
path: /health
port: 7700
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
livenessProbe:
httpGet:
path: /health
port: 7700
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
volumes:
- name: search-data
persistentVolumeClaim:
claimName: wanderer-search-data
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: search
namespace: {{ wanderer_namespace }}
spec:
type: {{ wanderer_search_service_type }}
selector:
app: search
ports:
- port: 7700
targetPort: 7700
protocol: TCP
+10
View File
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: wanderer-secrets
namespace: {{ wanderer_namespace }}
type: Opaque
stringData:
MEILI_MASTER_KEY: "{{ wanderer_env.meili_master_key }}"
POCKETBASE_ENCRYPTION_KEY: "{{ wanderer_env.pocketbase_encryption_key }}"
+104
View File
@@ -0,0 +1,104 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
namespace: {{ wanderer_namespace }}
spec:
replicas: {{ wanderer_replica_count.web }}
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: web
image: "{{ wanderer_images.web }}"
ports:
- containerPort: 3000
env:
- name: MEILI_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: MEILI_URL
- name: MEILI_MASTER_KEY
valueFrom:
secretKeyRef:
name: wanderer-secrets
key: MEILI_MASTER_KEY
- name: ORIGIN
valueFrom:
configMapKeyRef:
name: wanderer-config
key: ORIGIN
- name: BODY_SIZE_LIMIT
valueFrom:
configMapKeyRef:
name: wanderer-config
key: BODY_SIZE_LIMIT
- name: PUBLIC_POCKETBASE_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: PUBLIC_POCKETBASE_URL
- name: PUBLIC_DISABLE_SIGNUP
valueFrom:
configMapKeyRef:
name: wanderer-config
key: PUBLIC_DISABLE_SIGNUP
- name: UPLOAD_FOLDER
valueFrom:
configMapKeyRef:
name: wanderer-config
key: UPLOAD_FOLDER
- name: UPLOAD_USER
value: "{{ wanderer_upload_user }}"
- name: UPLOAD_PASSWORD
value: "{{ wanderer_upload_password }}"
- name: OVERPASS_API_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: OVERPASS_API_URL
- name: VALHALLA_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: VALHALLA_URL
- name: NOMINATIM_URL
valueFrom:
configMapKeyRef:
name: wanderer-config
key: NOMINATIM_URL
- name: PUBLIC_MAP_MAX_POLYLINES
valueFrom:
configMapKeyRef:
name: wanderer-config
key: PUBLIC_MAP_MAX_POLYLINES
volumeMounts:
- name: uploads
mountPath: /app/uploads
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 10
volumes:
- name: uploads
persistentVolumeClaim:
claimName: wanderer-web-uploads
+14
View File
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: web
namespace: {{ wanderer_namespace }}
spec:
type: {{ wanderer_service_type }}
selector:
app: web
ports:
- port: 3000
targetPort: 3000
protocol: TCP
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
localhost
+6
View File
@@ -0,0 +1,6 @@
#SPDX-License-Identifier: MIT-0
---
- hosts: localhost
remote_user: root
roles:
- ansible-role-wanderer
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# vars file for ansible-role-wanderer