From 7ddd15c4a55aee4fc5fba0f55eaa5d8805855b02 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 9 Nov 2022 00:17:22 -0800 Subject: [PATCH] Searx, Clippable, & Filebrowser services are now running on the host Reverse proxy is the last step before they are exposed to the outside --- playbooks/atlas/init/clippable/main.yml | 34 ++++++++++++++++++++ playbooks/atlas/init/filebrowser/main.yml | 23 +++++++++++++ playbooks/atlas/init/migrate-clips-files.yml | 14 ++++++++ playbooks/atlas/init/searx/main.yml | 30 +++++++++++++++++ playbooks/atlas/init/searx/settings.yml | 20 ++++++++++++ playbooks/atlas/init/setup-containers.yml | 8 +++++ playbooks/atlas/init/system-deps.yml | 7 ++++ 7 files changed, 136 insertions(+) create mode 100644 playbooks/atlas/init/clippable/main.yml create mode 100644 playbooks/atlas/init/filebrowser/main.yml create mode 100644 playbooks/atlas/init/migrate-clips-files.yml create mode 100644 playbooks/atlas/init/searx/main.yml create mode 100644 playbooks/atlas/init/searx/settings.yml create mode 100644 playbooks/atlas/init/setup-containers.yml diff --git a/playbooks/atlas/init/clippable/main.yml b/playbooks/atlas/init/clippable/main.yml new file mode 100644 index 0000000..8830603 --- /dev/null +++ b/playbooks/atlas/init/clippable/main.yml @@ -0,0 +1,34 @@ +--- +- hosts: atlas + become: yes + vars: + CLIPPABLE_ROOT: "{{ CLIPPABLE_MOUNT_POINT }}/clips" + tasks: + - name: Fetch vars for getting mount points + include_vars: + file: ../../vars/drives.yml + - name: Create mountpoints for volumes + file: + state: directory + path: "{{ CLIPPABLE_ROOT }}/{{ item }}" + loop: + - clips + - thumbnails + + - name: Pull latest Clippable Image + community.docker.docker_container: + name: clippable + image: registry.gitlab.com/shockrah/clippable:latest + pull: yes + restart_policy: always + recreate: yes + env: + SITE_NAME: "Shockrah's Clips" + SITE_DESC: "Short clips of random stuff I do" + SITE_URL: "https://clips.shockrah.xyz" + ports: + - "8482:8482" + volumes: + - "{{CLIPPABLE_ROOT}}/clips:/media/clips" + - "{{CLIPPABLE_ROOT}}/thumbnails:/media/thumbnails" + diff --git a/playbooks/atlas/init/filebrowser/main.yml b/playbooks/atlas/init/filebrowser/main.yml new file mode 100644 index 0000000..8d50524 --- /dev/null +++ b/playbooks/atlas/init/filebrowser/main.yml @@ -0,0 +1,23 @@ +# This playbook goes through the process of setting up a simple FTP server on +# the target host. +--- +- hosts: atlas + become: yes + tasks: + - name: Fetch vars for getting mount points + include_vars: + file: ../../vars/drives.yml + - name: Setup Filebrowser Container + community.docker.docker_container: + name: filebrowser + image: filebrowser/filebrowser + restart_policy: always + volumes: + - "{{ FILEBROWSER_MOUNT_POINT }}/files:/srv" + ports: + - "8000:80" + user: "0:0" + + + + diff --git a/playbooks/atlas/init/migrate-clips-files.yml b/playbooks/atlas/init/migrate-clips-files.yml new file mode 100644 index 0000000..8860400 --- /dev/null +++ b/playbooks/atlas/init/migrate-clips-files.yml @@ -0,0 +1,14 @@ +--- +- hosts: atlas + tasks: + - name: Fetch vars for getting mount points + include_vars: + file: ../vars/drives.yml + - name: Copy over Filebrowser & Clippable data from local + become: yes + copy: + src: "{{ item.src }}" + dest: "{{ item.dst }}" + loop: + - { src: "{{ filebrowser }}", dst: "{{ FILEBROWSER_MOUNT_POINT }}" } + - { src: "{{ clippable }}" , dst: "{{ CLIPPABLE_MOUNT_POINT }}" } diff --git a/playbooks/atlas/init/searx/main.yml b/playbooks/atlas/init/searx/main.yml new file mode 100644 index 0000000..1a15dbe --- /dev/null +++ b/playbooks/atlas/init/searx/main.yml @@ -0,0 +1,30 @@ +--- +- hosts: atlas + become: yes + tasks: + - name: Create /var/www/ Configuration Directory + file: + path: /var/www/ + state: directory + + - name: Create /var/www/searx/ Searx configuration Directory + file: + path: /var/www/searx + state: directory + + - name: Copy Searx Configuration to /var/www/searx + copy: + src: settings.yml + dest: /var/www/searx/settings.yml + + - name: Pull latest Searx Repo patches + community.docker.docker_container: + name: searx + image: searx/searx + pull: yes + restart_policy: always + recreate: yes + volumes: + - "/var/www/searx/settings.yml:/etc/searx/settings.yml" + ports: + - "8080:8080" diff --git a/playbooks/atlas/init/searx/settings.yml b/playbooks/atlas/init/searx/settings.yml new file mode 100644 index 0000000..5270c43 --- /dev/null +++ b/playbooks/atlas/init/searx/settings.yml @@ -0,0 +1,20 @@ +use_default_settings: True + +general: + debug : False # Debug mode, only for development + instance_name : "Project Athens SearX" # displayed name + +search: + safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict + autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default + default_lang : "" # Default search language - leave blank to detect from browser information or use codes from 'languages.py' + +server: + port : 8080 + bind_address : "127.0.0.1" # explicitly only listen on localhost + # This key only matters for API users which I don't care about + # Hence this is fine because meh.jpg + secret_key : "VnnTHjYycpMerevPKQ5DAngpcZ3in5R8wgshvz2kW1LBDw6Z/ytWGdkZfXZTdY7zMb0oe6UXoZ9a" + base_url : "https://search.project-athens.xyz" + image_proxy : False # Proxying image results through searx + diff --git a/playbooks/atlas/init/setup-containers.yml b/playbooks/atlas/init/setup-containers.yml new file mode 100644 index 0000000..9dfe304 --- /dev/null +++ b/playbooks/atlas/init/setup-containers.yml @@ -0,0 +1,8 @@ +# Here we just call other playbooks to setup the services in the same way +# that the alpha host would set them up. +# NOTE: lewdlad is not included here because it is deployed via pipeline +# in it's own repository +--- +- import_playbook: './searx/main.yml' +- import_playbook: './filebrowser/main.yml' +- import_playbook: './clippable/main.yml' diff --git a/playbooks/atlas/init/system-deps.yml b/playbooks/atlas/init/system-deps.yml index 1305427..557fd55 100644 --- a/playbooks/atlas/init/system-deps.yml +++ b/playbooks/atlas/init/system-deps.yml @@ -17,6 +17,13 @@ - gnupg - software-properties-common - lsb-release + - python3 + - python3-pip + + - name: Install docker-py + pip: + name: docker-py + state: present - name: Install docker GPG key apt_key: