From 2246ecb95241f40e21c59095b5f77f05a955dd50 Mon Sep 17 00:00:00 2001 From: Anarion Date: Thu, 14 Dec 2023 18:08:40 +0100 Subject: [PATCH] :sparkles: Add Activepieces --- README.md | 1 + nas.yml | 4 + roles/activepieces/defaults/main.yml | 56 ++++++++ roles/activepieces/docs/activepieces.md | 11 ++ .../molecule/default/molecule.yml | 16 +++ .../molecule/default/side_effect.yml | 10 ++ .../activepieces/molecule/default/verify.yml | 33 +++++ .../molecule/default/verify_stopped.yml | 33 +++++ roles/activepieces/tasks/main.yml | 128 ++++++++++++++++++ .../docs/applications/other/activepieces.md | 14 ++ 10 files changed, 306 insertions(+) create mode 100644 roles/activepieces/defaults/main.yml create mode 100644 roles/activepieces/docs/activepieces.md create mode 100644 roles/activepieces/molecule/default/molecule.yml create mode 100644 roles/activepieces/molecule/default/side_effect.yml create mode 100644 roles/activepieces/molecule/default/verify.yml create mode 100644 roles/activepieces/molecule/default/verify_stopped.yml create mode 100644 roles/activepieces/tasks/main.yml create mode 100644 website/docs/applications/other/activepieces.md diff --git a/README.md b/README.md index 871e8a4900..31968f2d7a 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ If you have a spare domain name you can configure applications to be accessible ## Available Applications +* [Activepieces](https://www.activepieces.com/) - an open source all-in-one automation tool * [Admidio](https://www.admidio.org/) - a free online membership management * [Airsonic](https://airsonic.github.io/) - catalog and stream music * [Authelia](https://www.authelia.com/) - The Single Sign-On Multi-Factor portal for web apps diff --git a/nas.yml b/nas.yml index d66a539132..1fe20da3ae 100644 --- a/nas.yml +++ b/nas.yml @@ -58,6 +58,10 @@ ### ### Applications ### + - role: activepieces + tags: + - activepieces + - role: admidio tags: - admidio diff --git a/roles/activepieces/defaults/main.yml b/roles/activepieces/defaults/main.yml new file mode 100644 index 0000000000..161e214133 --- /dev/null +++ b/roles/activepieces/defaults/main.yml @@ -0,0 +1,56 @@ +--- +activepieces_enabled: false +activepieces_available_externally: false + +# directories +activepieces_data_directory: "{{ docker_home }}/activepieces" + +# network +activepieces_port: "8129" +activepieces_hostname: "activepieces" +activepieces_network_name: "activepieces" + +# specs +activepieces_memory: 1g +activepieces_db_memory: 1g +activepieces_redis_memory: 1g + +# docker +activepieces_container_name: activepieces +activepieces_image_name: "activepieces/activepieces" +activepieces_image_version: "0.14.3" +activepieces_db_container_name: activepieces-db +activepieces_db_image_name: "postgres" +activepieces_db_image_version: "14.4" +activepieces_redis_container_name: activepieces-redis +activepieces_redis_image_name: "redis" +activepieces_redis_image_version: "7.0.7" +activepieces_user_id: "1000" +activepieces_group_id: "1000" + +activepieces_admin_username: "admin" +activepieces_admin_password: "admin" +activepieces_db_name: "activepieces" +activepieces_db_user: "activepieces" +activepieces_db_pass: "activepieces" + +# activepieces +activepieces_engine_executable_path: "dist/packages/engine/main.js" +activepieces_api_key: "" +activepieces_encryption_key: "7e19fad4c13eaea8f757afb12e8f9c41" +activepieces_jwt_secret: "super-secret" +activepieces_environment: "prod" +activepieces_frontend_url: "https://{{ activepieces_hostname }}.{{ ansible_nas_domain }}" +activepieces_webhook_timeout_seconds: "30" +activepieces_trigger_default_poll_interval: "5" +activepieces_postgres_database: "{{ activepieces_db_name }}" +activepieces_postgres_host: "{{ activepieces_db_container_name }}" +activepieces_postgres_port: "5432" +activepieces_postgres_username: "{{ activepieces_db_user }}" +activepieces_postgres_password: "{{ activepieces_db_pass }}" +activepieces_execution_mode: "UNSANDBOXED" +activepieces_redis_host: "{{ activepieces_redis_container_name }}" +activepieces_redis_port: "6379" +activepieces_sandbox_run_time_seconds: "600" +activepieces_telemetry_enabled: "false" +activepieces_templates_source_url: "https://cloud.activepieces.com/api/v1/flow-templates" diff --git a/roles/activepieces/docs/activepieces.md b/roles/activepieces/docs/activepieces.md new file mode 100644 index 0000000000..4008a5443b --- /dev/null +++ b/roles/activepieces/docs/activepieces.md @@ -0,0 +1,11 @@ +# Activepieces + +Homepage: + +Your friendliest open source all-in-one automation tool ✨ Workflow automation tool 100+ integration / Enterprise automation tool / ChatBot / Zapier Alternative + +## Usage + +Set `activepieces_enabled: true` in your `inventories//nas.yml` file. + +activepieces web interface can be found at . diff --git a/roles/activepieces/molecule/default/molecule.yml b/roles/activepieces/molecule/default/molecule.yml new file mode 100644 index 0000000000..77b1b51efb --- /dev/null +++ b/roles/activepieces/molecule/default/molecule.yml @@ -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: + activepieces_enabled: true + activepieces_data_directory: /tmp diff --git a/roles/activepieces/molecule/default/side_effect.yml b/roles/activepieces/molecule/default/side_effect.yml new file mode 100644 index 0000000000..9c9e264750 --- /dev/null +++ b/roles/activepieces/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: + activepieces_enabled: false diff --git a/roles/activepieces/molecule/default/verify.yml b/roles/activepieces/molecule/default/verify.yml new file mode 100644 index 0000000000..153b458209 --- /dev/null +++ b/roles/activepieces/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 activepieces db container state + community.docker.docker_container: + name: "{{ activepieces_db_container_name }}" + register: result_db + + - name: Get activepieces redis container state + community.docker.docker_container: + name: "{{ activepieces_db_container_name }}" + register: result_redis + + - name: Get activepieces container state + community.docker.docker_container: + name: "{{ activepieces_container_name }}" + register: result + + - name: Check if activepieces containers are running + ansible.builtin.assert: + that: + - result_db.container['State']['Status'] == "running" + - result_db.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/activepieces/molecule/default/verify_stopped.yml b/roles/activepieces/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..251a31e0a5 --- /dev/null +++ b/roles/activepieces/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 activepieces + community.docker.docker_container: + name: "{{ activepieces_container_name }}" + state: absent + register: result + + - name: Try and stop and remove activepieces redis + community.docker.docker_container: + name: "{{ activepieces_db_container_name }}" + state: absent + register: result_redis + + - name: Try and stop and remove activepieces db + community.docker.docker_container: + name: "{{ activepieces_db_container_name }}" + state: absent + register: result_db + + - name: Check if activepieces is stopped + ansible.builtin.assert: + that: + - not result.changed + - not result_redis.changed + - not result_db.changed diff --git a/roles/activepieces/tasks/main.yml b/roles/activepieces/tasks/main.yml new file mode 100644 index 0000000000..cdf5cf88bf --- /dev/null +++ b/roles/activepieces/tasks/main.yml @@ -0,0 +1,128 @@ +--- +- name: Start Activepieces + block: + - name: Create Activepieces Directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + with_items: + - "{{ activepieces_data_directory }}" + - "{{ activepieces_data_directory }}/config" + + - name: Create Activepieces network + community.docker.docker_network: + name: "{{ activepieces_network_name }}" + + - name: Create Activepieces Postgress Docker Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ activepieces_db_container_name }}" + image: "{{ activepieces_db_image_name }}:{{ activepieces_db_image_version }}" + pull: true + volumes: + - "{{ activepieces_data_directory }}/db:/var/lib/postgresql/data:rw" + networks: + - name: "{{ activepieces_network_name }}" + network_mode: "{{ activepieces_network_name }}" + env: + POSTGRES_PASSWORD: "{{ activepieces_db_pass }}" + POSTGRES_USER: "{{ activepieces_db_user }}" + POSTGRES_DB: "{{ activepieces_db_name }}" + labels: + traefik.enable: "false" + restart_policy: always + memory: "{{ activepieces_db_memory }}" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U activepieces"] + start_period: 20s + interval: 5s + retries: 12 + timeout: 5s + + - name: Create Activepieces Redis Docker Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ activepieces_redis_container_name }}" + image: "{{ activepieces_redis_image_name }}:{{ activepieces_redis_image_version }}" + pull: true + volumes: + - "{{ activepieces_data_directory }}/redis:/data:rw" + networks: + - name: "{{ activepieces_network_name }}" + network_mode: "{{ activepieces_network_name }}" + labels: + traefik.enable: "false" + restart_policy: always + memory: "{{ activepieces_redis_memory }}" + + - name: Create Activepieces Docker Container + community.docker.docker_container: + container_default_behavior: no_defaults + name: "{{ activepieces_container_name }}" + image: "{{ activepieces_image_name }}:{{ activepieces_image_version }}" + pull: true + networks: + - name: "{{ activepieces_network_name }}" + network_mode: "{{ activepieces_network_name }}" + volumes: + - "{{ activepieces_data_directory }}/config/config.toml:/activepieces/config.toml" + ports: + - "{{ activepieces_port }}:80" + env: + TZ: "{{ ansible_nas_timezone }}" + PUID: "{{ activepieces_user_id | quote }}" + PGID: "{{ activepieces_group_id | quote }}" + ## It's advisable to consult the documentation and use the tools/deploy.sh to generate the passwords, keys, instead of manually filling them. + + AP_ENGINE_EXECUTABLE_PATH: "{{ activepieces_engine_executable_path }}" + + ## Random Long Password (Optional for community edition) + AP_API_KEY: "{{ activepieces_api_key }}" + + ## 256 bit encryption key, 32 hex character + AP_ENCRYPTION_KEY: "{{ activepieces_encryption_key }}" + + ## JWT Secret + AP_JWT_SECRET: "{{ activepieces_jwt_secret }}" + + AP_ENVIRONMENT: "{{ activepieces_environment }}" + AP_FRONTEND_URL: "{{ activepieces_frontend_url }}" + AP_WEBHOOK_TIMEOUT_SECONDS: "{{ activepieces_webhook_timeout_seconds }}" + AP_TRIGGER_DEFAULT_POLL_INTERVAL: "{{ activepieces_trigger_default_poll_interval }}" + AP_POSTGRES_DATABASE: "{{ activepieces_postgres_database }}" + AP_POSTGRES_HOST: "{{ activepieces_postgres_host }}" + AP_POSTGRES_PORT: "{{ activepieces_postgres_port }}" + AP_POSTGRES_USERNAME: "{{ activepieces_postgres_username }}" + AP_POSTGRES_PASSWORD: "{{ activepieces_postgres_password }}" + AP_EXECUTION_MODE: "{{ activepieces_execution_mode }}" + AP_REDIS_HOST: "{{ activepieces_redis_host }}" + AP_REDIS_PORT: "{{ activepieces_redis_port }}" + AP_SANDBOX_RUN_TIME_SECONDS: "{{ activepieces_sandbox_run_time_seconds }}" + AP_TELEMETRY_ENABLED: "{{ activepieces_telemetry_enabled }}" + AP_TEMPLATES_SOURCE_URL: "{{ activepieces_templates_source_url }}" + restart_policy: unless-stopped + memory: "{{ activepieces_memory }}" + labels: + traefik.enable: "{{ activepieces_available_externally | string }}" + traefik.http.routers.activepieces.rule: "Host(`{{ activepieces_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.activepieces.tls.certresolver: "letsencrypt" + traefik.http.routers.activepieces.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.activepieces.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.activepieces.loadbalancer.server.port: "80" + when: activepieces_enabled is true + +- name: Stop Activepieces + block: + - name: Stop Activepieces + community.docker.docker_container: + name: "{{ activepieces_container_name }}" + state: absent + - name: Stop Activepieces Redis + community.docker.docker_container: + name: "{{ activepieces_redis_container_name }}" + state: absent + - name: Stop Activepieces DB + community.docker.docker_container: + name: "{{ activepieces_db_container_name }}" + state: absent + when: activepieces_enabled is false diff --git a/website/docs/applications/other/activepieces.md b/website/docs/applications/other/activepieces.md new file mode 100644 index 0000000000..10f5f21185 --- /dev/null +++ b/website/docs/applications/other/activepieces.md @@ -0,0 +1,14 @@ +--- +title: "Activepieces" +description: "An open source all-in-one automation tool" +--- + +Homepage: + +Your friendliest open source all-in-one automation tool ✨ Workflow automation tool 100+ integration / Enterprise automation tool / ChatBot / Zapier Alternative + +## Usage + +Set `activepieces_enabled: true` in your `inventories//nas.yml` file. + +activepieces web interface can be found at .