forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from anarion80/add_pretix
✨ Add Pretix
- Loading branch information
Showing
11 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,6 +725,10 @@ | |
tags: | ||
- portainer | ||
|
||
- role: pretix | ||
tags: | ||
- pretix | ||
|
||
- role: prowlarr | ||
tags: | ||
- prowlarr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
pretix_enabled: false | ||
pretix_available_externally: false | ||
|
||
pretix_database_username: pretix_user | ||
pretix_database_password: top_secret | ||
pretix_database_root_password: top_top_secret | ||
|
||
# directories | ||
pretix_home: "{{ docker_home }}/pretix" | ||
pretix_data_directory: "{{ pretix_home }}/pretix" | ||
|
||
# network | ||
pretix_port: "8166" | ||
pretix_hostname: "pretix" | ||
pretix_network_name: "pretix" | ||
|
||
# docker | ||
pretix_container_name: "pretix" | ||
pretix_image_name: "pretix/standalone" | ||
pretix_image_version: "stable" | ||
|
||
pretix_db_container_name: "pretix-db" | ||
pretix_db_image_name: "postgres" | ||
pretix_db_image_version: "15" | ||
|
||
pretix_redis_container_name: "pretix-redis" | ||
pretix_redis_image_name: "redis" | ||
pretix_redis_image_version: "alpine" | ||
|
||
# specs | ||
pretix_memory: 1g | ||
pretix_db_memory: 1g | ||
pretix_redis_memory: 1g | ||
|
||
# pretix | ||
pretix_postgres_password: "pretix" | ||
pretix_postgres_user: "pretix" | ||
pretix_postgres_db: "pretix" | ||
pretix_url: "https://{{ pretix_hostname }}.{{ ansible_nas_domain }}" | ||
pretix_currency: "EUR" | ||
pretix_db_backend: "postgresql" | ||
pretix_postgres_db_host: "{{ pretix_db_container_name }}" | ||
pretix_from_email: "pretix@{{ ansible_nas_domain }}" | ||
pretix_email_host: "" | ||
pretix_email_user: "" | ||
pretix_email_password: "" | ||
pretix_email_port: "25" | ||
pretix_email_tls: "off" | ||
pretix_email_ssl: "off" | ||
pretix_redis_host: "redis://{{ pretix_redis_container_name }}:6379" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
platforms: | ||
- name: instance | ||
image: geerlingguy/docker-ubuntu2204-ansible:latest | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:ro | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- /tmp:/tmp:rw | ||
privileged: true | ||
pre_build_image: true | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
pretix_enabled: true | ||
prefix_data_directory: /tmp/prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
pretix_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get pretix container state | ||
community.docker.docker_container: | ||
name: "{{ pretix_container_name }}" | ||
register: result | ||
|
||
- name: Check if pretix containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove pretix | ||
community.docker.docker_container: | ||
name: "{{ pretix_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if joomla is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
- name: Start Pretix | ||
block: | ||
- name: Create pretix Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: 15371 | ||
group: 15371 | ||
with_items: | ||
- "{{ pretix_data_directory }}" | ||
- "{{ pretix_data_directory }}/data" | ||
|
||
- name: Template Pretix config | ||
ansible.builtin.template: | ||
src: pretix.cfg.j2 | ||
dest: "{{ pretix_data_directory }}/pretix.cfg" | ||
register: pretix_config | ||
|
||
- name: Create Pretix network | ||
community.docker.docker_network: | ||
name: "{{ pretix_network_name }}" | ||
|
||
- name: Pretix Docker DB Container | ||
community.docker.docker_container: | ||
name: "{{ pretix_db_container_name }}" | ||
image: "{{ pretix_db_image_name }}:{{ pretix_db_image_version }}" | ||
pull: true | ||
networks: | ||
- name: "{{ pretix_network_name }}" | ||
network_mode: "{{ pretix_network_name }}" | ||
container_default_behavior: no_defaults | ||
volumes: | ||
- "{{ pretix_data_directory }}/postgres:/var/lib/postgresql/data:rw" | ||
env: | ||
POSTGRES_PASSWORD: "{{ pretix_postgres_password }}" | ||
POSTGRES_USER: "{{ pretix_postgres_user }}" | ||
POSTGRES_DB: "{{ pretix_postgres_db }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ pretix_db_memory }}" | ||
labels: | ||
traefik.enable: "false" | ||
|
||
- name: Create Pretix Redis | ||
community.docker.docker_container: | ||
name: "{{ pretix_redis_container_name }}" | ||
image: "{{ pretix_redis_image_name }}:{{ pretix_redis_image_version }}" | ||
pull: true | ||
networks: | ||
- name: "{{ pretix_network_name }}" | ||
network_mode: "{{ pretix_network_name }}" | ||
container_default_behavior: no_defaults | ||
restart_policy: unless-stopped | ||
memory: "{{ pretix_redis_memory }}" | ||
labels: | ||
traefik.enable: "false" | ||
|
||
- name: Pretix Docker Container | ||
community.docker.docker_container: | ||
name: "{{ pretix_container_name }}" | ||
image: "{{ pretix_image_name }}:{{ pretix_image_version }}" | ||
pull: true | ||
networks: | ||
- name: "{{ pretix_network_name }}" | ||
network_mode: "{{ pretix_network_name }}" | ||
container_default_behavior: no_defaults | ||
volumes: | ||
- "{{ pretix_data_directory }}/data:/data" | ||
- "{{ pretix_data_directory }}/pretix.cfg:/etc/pretix/pretix.cfg" | ||
ports: | ||
- "{{ pretix_port }}:80" | ||
restart_policy: unless-stopped | ||
memory: "{{ pretix_memory }}" | ||
labels: | ||
traefik.enable: "{{ pretix_available_externally | string }}" | ||
traefik.http.routers.pretix.rule: "Host(`{{ pretix_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.pretix.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.pretix.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.pretix.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.pretix.loadbalancer.server.port: "80" | ||
when: pretix_enabled is true | ||
|
||
- name: Stop Pretix | ||
block: | ||
- name: Stop Pretix | ||
community.docker.docker_container: | ||
name: "{{ pretix_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Pretix DB | ||
community.docker.docker_container: | ||
name: "{{ pretix_db_container_name }}" | ||
state: absent | ||
when: pretix_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[pretix] | ||
instance_name=My pretix installation | ||
url={{ pretix_url }} | ||
currency={{ pretix_currency }} | ||
; DO NOT change the following value, it has to be set to the location of the | ||
; directory *inside* the docker container | ||
datadir=/data | ||
trust_x_forwarded_for=on | ||
trust_x_forwarded_proto=on | ||
|
||
[database] | ||
backend={{ pretix_db_backend }} | ||
name={{ pretix_postgres_db }} | ||
user={{ pretix_postgres_user }} | ||
; Replace with the password you chose above | ||
password={{ pretix_postgres_password }} | ||
; In most docker setups, 172.17.0.1 is the address of the docker host. Adjust | ||
; this to wherever your database is running, e.g. the name of a linked container. | ||
host={{ pretix_postgres_db_host }} | ||
|
||
[mail] | ||
; See config file documentation for more options | ||
from={{ pretix_from_email }} | ||
; This is the default IP address of your docker host in docker's virtual | ||
; network. Make sure postfix listens on this address. | ||
host={{ pretix_email_host }} | ||
user={{ pretix_email_user }} | ||
password={{ pretix_email_password }} | ||
port={{ pretix_email_port }} | ||
tls={{ pretix_email_tls }} | ||
ssl={{ pretix_email_ssl }} | ||
|
||
[redis] | ||
location={{ pretix_redis_host }}/0 | ||
; Remove the following line if you are unsure about your redis' security | ||
; to reduce impact if redis gets compromised. | ||
sessions=true | ||
|
||
[celery] | ||
backend={{ pretix_redis_host }}/1 | ||
broker={{ pretix_redis_host }}/2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Pretix" | ||
description: "Ticketing software that cares about your event—all the way." | ||
--- | ||
|
||
Homepage: [https://pretix.eu/about/en/](https://pretix.eu/about/en/) | ||
|
||
Ticketing software that cares about your event—all the way. | ||
|
||
## Usage | ||
|
||
Set `pretix_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
Pretix web interface can be found at [http://ansible_nas_host_or_ip:8166](http://ansible_nas_host_or_ip:8166). Log in as `admin@localhost` with a password of `admin`. Don’t forget to change that password! Create an organizer first, then create an event and start selling tickets! |