diff --git a/README.md b/README.md index 759f011c30..301a976d39 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ If you have a spare domain name you can configure applications to be accessible * [openHAB](https://www.openhab.org/) - A vendor and technology agnostic open source automation software for your home * [openLDAP](https://www.openldap.org/) - An open source implementation of the Lightweight Directory Access Protocol * [Organizr](https://organizr.app/) - ORGANIZR aims to be your one stop shop for your Servers Frontend. +* [Overleaf](https://github.com/overleaf/overleaf) - A web-based collaborative LaTeX editor * [overseerr](https://docs.overseerr.dev) - open source software application for managing requests for your media library * [Paperless_ng](https://github.com/jonaswinkler/paperless-ng) - Scan, index and archive all your physical documents * [Photofield](https://github.com/SmilyOrg/photofield) - Experimental fast photo viewer diff --git a/nas.yml b/nas.yml index fa3939bdb8..7cc39a3da4 100644 --- a/nas.yml +++ b/nas.yml @@ -490,6 +490,10 @@ tags: - organizr + - role: overleaf + tags: + - overleaf + - role: overseerr tags: - overseerr diff --git a/roles/overleaf/defaults/main.yml b/roles/overleaf/defaults/main.yml new file mode 100644 index 0000000000..c946f4296c --- /dev/null +++ b/roles/overleaf/defaults/main.yml @@ -0,0 +1,92 @@ +--- +overleaf_enabled: false +overleaf_available_externally: false + +# directories +overleaf_data_directory: "{{ docker_home }}/overleaf" + +# network +overleaf_port: "8127" +overleaf_hostname: "overleaf" +overleaf_network_name: "overleaf" + +# specs +overleaf_memory: 1g +overleaf_mongo_memory: 1g +overleaf_redis_memory: 1g + +# docker +overleaf_container_name: overleaf +overleaf_image_name: "sharelatex/sharelatex" +overleaf_image_version: latest + +overleaf_mongo_container_name: overleaf-mongo +overleaf_mongo_image_name: "mongo" +overleaf_mongo_image_version: "4.4" + +overleaf_redis_container_name: overleaf-redis +overleaf_redis_image_name: "redis" +overleaf_redis_image_version: "6.2" +overleaf_user_id: "1000" +overleaf_group_id: "1000" + +# overleaf +overleaf_app_name: "Ansible-NAS Overleaf" +overleaf_mongo_url: "mongodb://{{ overleaf_mongo_container_name }}/sharelatex" +# Same property, unfortunately with different names in +# different locations +overleaf_redis_host: "{{ overleaf_redis_container_name }}" +overleaf_enabled_linked_file_types: "'project_file,project_output_file'" +# Enables Thumbnail generation using ImageMagick +overleaf_enabled_conversions: "true" +# Disables email confirmation requirement +overleaf_email_confirmation_disabled: "true" +# temporary fix for LuaLaTex compiles +# see https://github.com/overleaf/overleaf/issues/695 +overleaf_texmfvar: "/var/lib/sharelatex/tmp/texmf-var" +## Set for SSL via nginx-proxy +# overleaf_virtual_host: "103.112.212.22" +overleaf_site_url: "https://{{ overleaf_hostname }}.{{ ansible_nas_domain }}" +overleaf_nav_title: "Ansible-NAS ShareLaTeX Instance" +overleaf_header_image_url: "http://somewhere.com/mylogo.png" +overleaf_admin_email: "overleaf@{{ ansible_nas_domain }}" + +overleaf_left_footer: "[{\"text\": \"Powered by ShareLaTeX 2016\"},{\"text\": \"Another page I want to link to can be found here\"} ]" +overleaf_right_footer: "[{\"text\": \"Hello I am on the Right\"} ]" + +overleaf_email_from_address: "overleaf@{{ ansible_nas_domain }}" + +overleaf_email_aws_ses_access_key_id: "" +overleaf_email_aws_ses_secret_key: "" + +overleaf_email_smtp_host: "smtp.mydomain.com" +overleaf_email_smtp_port: "587" +overleaf_email_smtp_secure: "false" +overleaf_email_smtp_user: "" +overleaf_email_smtp_pass: "" +overleaf_email_smtp_tls_reject_unauth: "true" +overleaf_email_smtp_ignore_tls: "false" +overleaf_email_smtp_name: "'127.0.0.1'" +overleaf_email_smtp_logger: "true" +overleaf_custom_email_footer: "This system is run by Ansible-NAS" + +overleaf_enable_cron_resource_deletion: "true" + + +# Database settings +# These are currently only required for configuring PostreSQL. +# By default, overleaf uses SQLite for which you don't need to configure anything. + +# Database engine, can be sqlite (default) or postgres +overleaf_db_engine: "sqlite" +# Database name (default: overleaf) +overleaf_db_database: "overleaf" +# Username to connect to the database server (default: overleaf) +overleaf_db_user: "overleaf" +# Password to connect to the database server +overleaf_db_password: "overleaf" +# The hostname where the database is hosted (default: localhost) +overleaf_db_host: "" +# Port use to connect to the database server +# Should use the default port if not set +overleaf_db_port: "" diff --git a/roles/overleaf/docs/overleaf.md b/roles/overleaf/docs/overleaf.md new file mode 100644 index 0000000000..4f20715b4a --- /dev/null +++ b/roles/overleaf/docs/overleaf.md @@ -0,0 +1,13 @@ +# Overleaf + +Homepage: + +Overleaf is an open-source online real-time collaborative LaTeX editor. + +## Usage + +Set `overleaf_enabled: true` in your `inventories//nas.yml` file. + +Overleaf web interface can be found at . + +Go to and register an admin user. diff --git a/roles/overleaf/molecule/default/molecule.yml b/roles/overleaf/molecule/default/molecule.yml new file mode 100644 index 0000000000..82b489c143 --- /dev/null +++ b/roles/overleaf/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + overleaf_enabled: true diff --git a/roles/overleaf/molecule/default/side_effect.yml b/roles/overleaf/molecule/default/side_effect.yml new file mode 100644 index 0000000000..997050bdce --- /dev/null +++ b/roles/overleaf/molecule/default/side_effect.yml @@ -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: + overleaf_enabled: false diff --git a/roles/overleaf/molecule/default/verify.yml b/roles/overleaf/molecule/default/verify.yml new file mode 100644 index 0000000000..4c5126a366 --- /dev/null +++ b/roles/overleaf/molecule/default/verify.yml @@ -0,0 +1,33 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Include vars + ansible.builtin.include_vars: + file: ../../defaults/main.yml + + - name: Get overleaf mongo container state + community.docker.docker_container: + name: "{{ overleaf_mongo_container_name }}" + register: result_mongo + + - name: Get overleaf redis container state + community.docker.docker_container: + name: "{{ overleaf_redis_container_name }}" + register: result_redis + + - name: Get overleaf container state + community.docker.docker_container: + name: "{{ overleaf_container_name }}" + register: result + + - name: Check if overleaf containers are running + ansible.builtin.assert: + that: + - result_mongo.container['State']['Status'] == "running" + - result_mongo.container['State']['Restarting'] == false + - result_redis.container['State']['Status'] == "running" + - result_redis.container['State']['Restarting'] == false + - result.container['State']['Status'] == "running" + - result.container['State']['Restarting'] == false diff --git a/roles/overleaf/molecule/default/verify_stopped.yml b/roles/overleaf/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..6bf1d39ade --- /dev/null +++ b/roles/overleaf/molecule/default/verify_stopped.yml @@ -0,0 +1,33 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - name: Include vars + ansible.builtin.include_vars: + file: ../../defaults/main.yml + + - name: Try and stop and remove overleaf + community.docker.docker_container: + name: "{{ overleaf_container_name }}" + state: absent + register: result + + - name: Try and stop and remove overleaf redis + community.docker.docker_container: + name: "{{ overleaf_redis_container_name }}" + state: absent + register: result_redis + + - name: Try and stop and remove overleaf mongo + community.docker.docker_container: + name: "{{ overleaf_mongo_container_name }}" + state: absent + register: result_mongo + + - name: Check if overleaf is stopped + ansible.builtin.assert: + that: + - not result.changed + - not result_redis.changed + - not result_mongo.changed diff --git a/roles/overleaf/tasks/main.yml b/roles/overleaf/tasks/main.yml new file mode 100644 index 0000000000..ae2eabb426 --- /dev/null +++ b/roles/overleaf/tasks/main.yml @@ -0,0 +1,143 @@ +--- +- name: Start Overleaf + block: + - name: Create overleaf Directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + with_items: + - "{{ overleaf_data_directory }}" + - "{{ overleaf_data_directory }}/data" + - "{{ overleaf_data_directory }}/mongo_data" + - "{{ overleaf_data_directory }}/redis_data" + + - name: Create Overleaf Network + community.docker.docker_network: + name: "{{ overleaf_network_name }}" + + - name: Create Overleaf Mongo Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ overleaf_mongo_container_name }}" + image: "{{ overleaf_mongo_image_name }}:{{ overleaf_mongo_image_version }}" + pull: true + networks: + - name: "{{ overleaf_network_name }}" + network_mode: "{{ overleaf_network_name }}" + exposed_ports: + - 27017 + volumes: + - "{{ overleaf_data_directory }}/mongo_data:/data/db" + env: + MONGODB_REPLICA_SET_MODE: primary + ALLOW_EMPTY_PASSWORD: 'yes' + command: "--replSet overleaf" + healthcheck: + test: "mongo --quiet --eval 'rs.hello().setName ? rs.hello().setName : rs.initiate({_id: \"overleaf\",members:[{_id: 0, host:\"{{ overleaf_mongo_container_name }}:27017\"}]})'" + labels: + traefik.enable: "false" + restart_policy: always + memory: "{{ overleaf_mongo_memory }}" + + - name: Create Overleaf Redis Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ overleaf_redis_container_name }}" + image: "{{ overleaf_redis_image_name }}:{{ overleaf_redis_image_version }}" + pull: true + networks: + - name: "{{ overleaf_network_name }}" + network_mode: "{{ overleaf_network_name }}" + exposed_ports: + - 6379 + volumes: + - "{{ overleaf_data_directory }}/redis_data:/data" + labels: + traefik.enable: "false" + restart_policy: always + memory: "{{ overleaf_redis_memory }}" + + - name: Create Overleaf Docker Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ overleaf_container_name }}" + image: "{{ overleaf_image_name }}:{{ overleaf_image_version }}" + pull: true + networks: + - name: "{{ overleaf_network_name }}" + network_mode: "{{ overleaf_network_name }}" + volumes: + - "{{ overleaf_data_directory }}/data:/var/lib/sharelatex" + ports: + - "{{ overleaf_port }}:80" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ overleaf_user_id | quote }}" + PGID: "{{ overleaf_group_id | quote }}" + SHARELATEX_APP_NAME: "{{ overleaf_app_name }}" + SHARELATEX_MONGO_URL: "{{ overleaf_mongo_url }}" + # Same property, unfortunately with different names in + # different locations + SHARELATEX_REDIS_HOST: "{{ overleaf_redis_host }}" + REDIS_HOST: "{{ overleaf_redis_host }}" + ENABLED_LINKED_FILE_TYPES: "{{ overleaf_enabled_linked_file_types }}" + # Enables Thumbnail generation using ImageMagick + ENABLE_CONVERSIONS: "{{ overleaf_enabled_conversions }}" + # Disables email confirmation requirement + EMAIL_CONFIRMATION_DISABLED: "{{ overleaf_email_confirmation_disabled }}" + # temporary fix for LuaLaTex compiles + # see https://github.com/overleaf/overleaf/issues/695 + TEXMFVAR: "{{ overleaf_texmfvar }}" + ## Set for SSL via nginx-proxy + # VIRTUAL_HOST: "{{ overleaf_virtual_host }}" + SHARELATEX_SITE_URL: "{{ overleaf_site_url }}" + SHARELATEX_NAV_TITLE: "{{ overleaf_nav_title }}" + SHARELATEX_HEADER_IMAGE_URL: "{{ overleaf_header_image_url }}" + SHARELATEX_ADMIN_EMAIL: "{{ overleaf_admin_email }}" + + SHARELATEX_LEFT_FOOTER: "{{ overleaf_left_footer | string }}" + SHARELATEX_RIGHT_FOOTER: "{{ overleaf_right_footer | string }}" + + SHARELATEX_EMAIL_FROM_ADDRESS: "{{ overleaf_email_from_address }}" + + SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID: "{{ overleaf_email_aws_ses_access_key_id }}" + SHARELATEX_EMAIL_AWS_SES_SECRET_KEY: "{{ overleaf_email_aws_ses_secret_key }}" + + SHARELATEX_EMAIL_SMTP_HOST: "{{ overleaf_email_smtp_host }}" + SHARELATEX_EMAIL_SMTP_PORT: "{{ overleaf_email_smtp_port }}" + SHARELATEX_EMAIL_SMTP_SECURE: "{{ overleaf_email_smtp_secure }}" + SHARELATEX_EMAIL_SMTP_USER: "{{ overleaf_email_smtp_user }}" + SHARELATEX_EMAIL_SMTP_PASS: "{{ overleaf_email_smtp_pass }}" + SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH: "{{ overleaf_email_smtp_tls_reject_unauth }}" + SHARELATEX_EMAIL_SMTP_IGNORE_TLS: "{{ overleaf_email_smtp_ignore_tls }}" + SHARELATEX_EMAIL_SMTP_NAME: "{{ overleaf_email_smtp_name }}" + SHARELATEX_EMAIL_SMTP_LOGGER: "{{ overleaf_email_smtp_logger }}" + SHARELATEX_CUSTOM_EMAIL_FOOTER: "{{ overleaf_custom_email_footer }}" + + ENABLE_CRON_RESOURCE_DELETION: "{{ overleaf_enable_cron_resource_deletion }}" + restart_policy: unless-stopped + memory: "{{ overleaf_memory }}" + labels: + traefik.enable: "{{ overleaf_available_externally | string }}" + traefik.http.routers.overleaf.rule: "Host(`{{ overleaf_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.overleaf.tls.certresolver: "letsencrypt" + traefik.http.routers.overleaf.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.overleaf.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.overleaf.loadbalancer.server.port: "80" + when: overleaf_enabled is true + +- name: Stop Overleaf + block: + - name: Stop Overleaf + community.docker.docker_container: + name: "{{ overleaf_container_name }}" + state: absent + - name: Stop Overleaf Redis + community.docker.docker_container: + name: "{{ overleaf_redis_container_name }}" + state: absent + - name: Stop Overleaf Mongo + community.docker.docker_container: + name: "{{ overleaf_mongo_container_name }}" + state: absent + when: overleaf_enabled is false diff --git a/website/docs/applications/other/overleaf.md b/website/docs/applications/other/overleaf.md new file mode 100644 index 0000000000..0a4e9bb955 --- /dev/null +++ b/website/docs/applications/other/overleaf.md @@ -0,0 +1,16 @@ +--- +title: "Overleaf" +description: "Open-source online real-time collaborative LaTeX editor" +--- + +Homepage: + +Overleaf is an open-source online real-time collaborative LaTeX editor. + +## Usage + +Set `overleaf_enabled: true` in your `inventories//nas.yml` file. + +Overleaf web interface can be found at . + +Go to and register an admin user.