forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Add Chatwoot * 🚨 Fix lint * 🚨 Fix lint again
- Loading branch information
Showing
11 changed files
with
809 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 |
---|---|---|
|
@@ -122,6 +122,10 @@ | |
tags: | ||
- chatpad | ||
|
||
- role: chatwoot | ||
tags: | ||
- chatwoot | ||
|
||
- role: claper | ||
tags: | ||
- claper | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,11 @@ | ||
# Chatwoot | ||
|
||
Homepage: [https://github.com/chatwoot/chatwoot](https://github.com/chatwoot/chatwoot) | ||
|
||
Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. | ||
|
||
## Usage | ||
|
||
Set `chatwoot_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
chatwoot web interface can be found at [http://ansible_nas_host_or_ip:3022](http://ansible_nas_host_or_ip:3022). |
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,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
chatwoot_enabled: true |
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: | ||
chatwoot_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,40 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get chatwoot postgres container state | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_postgres_container_name }}" | ||
register: result_postgres | ||
|
||
- name: Get chatwoot redis container state | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_redis_container_name }}" | ||
register: result_redis | ||
|
||
- name: Get chatwoot rails container state | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_rails_container_name }}" | ||
register: result_rails | ||
|
||
- name: Get chatwoot sidekick container state | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_sidekick_container_name }}" | ||
register: result_sidekick | ||
|
||
- name: Check if chatwoot 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_rails.container['State']['Status'] == "running" | ||
- result_rails.container['State']['Restarting'] == false | ||
- result_sidekick.container['State']['Status'] == "running" | ||
- result_sidekick.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,40 @@ | ||
--- | ||
- 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 chatwoot postgres | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_postgres_container_name }}" | ||
state: absent | ||
register: result_postgres | ||
|
||
- name: Try and stop and remove chatwoot redis | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_redis_container_name }}" | ||
state: absent | ||
register: result_redis | ||
|
||
- name: Try and stop and remove chatwoot sidekick | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_sidekick_container_name }}" | ||
state: absent | ||
register: result_sidekick | ||
|
||
- name: Try and stop and remove chatwoot rails | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_rails_container_name }}" | ||
state: absent | ||
register: result_rails | ||
|
||
- name: Check if chatwoot is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result_postgres.changed | ||
- not result_redis.changed | ||
- not result_sidekick.changed | ||
- not result_rails.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,123 @@ | ||
--- | ||
- name: Start Chatwoot | ||
block: | ||
- name: Create Chatwoot Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ chatwoot_data_directory }}" | ||
|
||
- name: Create Chatwoot network | ||
community.docker.docker_network: | ||
name: "{{ chatwoot_network_name }}" | ||
|
||
- name: Create Chatwoot Postgres Docker Container | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_postgres_container_name }}" | ||
image: "{{ chatwoot_postgres_image_name }}:{{ chatwoot_postgres_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ chatwoot_data_directory }}/postgres:/var/lib/postgresql/data:rw" | ||
networks: | ||
- name: "{{ chatwoot_network_name }}" | ||
network_mode: "{{ chatwoot_network_name }}" | ||
container_default_behavior: no_defaults | ||
env: | ||
POSTGRES_DB: "{{ chatwoot_postgres_database }}" | ||
POSTGRES_USER: "{{ chatwoot_postgres_username }}" | ||
POSTGRES_PASSWORD: "{{ chatwoot_postgres_password }}" | ||
labels: | ||
traefik.enable: "false" | ||
restart_policy: always | ||
memory: "{{ chatwoot_postgres_memory }}" | ||
|
||
- name: Create Chatwoot Redis Docker Container | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_redis_container_name }}" | ||
image: "{{ chatwoot_redis_image_name }}:{{ chatwoot_redis_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ chatwoot_data_directory }}/redis:/data:rw" | ||
networks: | ||
- name: "{{ chatwoot_network_name }}" | ||
network_mode: "{{ chatwoot_network_name }}" | ||
container_default_behavior: no_defaults | ||
command: ["sh", "-c", "redis-server --requirepass \"{{ chatwoot_redis_password }}\""] | ||
labels: | ||
traefik.enable: "false" | ||
restart_policy: always | ||
memory: "{{ chatwoot_redis_memory }}" | ||
|
||
- name: Create Chatwoot Rails Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ chatwoot_rails_container_name }}" | ||
image: "{{ chatwoot_rails_image_name }}:{{ chatwoot_rails_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ chatwoot_data_directory }}/storage:/app/storage:rw" | ||
networks: | ||
- name: "{{ chatwoot_network_name }}" | ||
network_mode: "{{ chatwoot_network_name }}" | ||
ports: | ||
- "{{ chatwoot_port }}:3000" | ||
env: "{{ chatwoot_env }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ chatwoot_rails_memory }}" | ||
entrypoint: docker/entrypoints/rails.sh | ||
command: ['bundle', 'exec', 'rails', 's', '-p', '3000', '-b', '0.0.0.0'] | ||
labels: | ||
traefik.enable: "{{ chatwoot_available_externally | string }}" | ||
traefik.http.routers.chatwoot.rule: "Host(`{{ chatwoot_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.chatwoot.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.chatwoot.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.chatwoot.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.chatwoot.loadbalancer.server.port: "3000" | ||
|
||
- name: Create Chatwoot Sidekick Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ chatwoot_sidekick_container_name }}" | ||
image: "{{ chatwoot_sidekick_image_name }}:{{ chatwoot_sidekick_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ chatwoot_data_directory }}/storage:/app/storage:rw" | ||
networks: | ||
- name: "{{ chatwoot_network_name }}" | ||
network_mode: "{{ chatwoot_network_name }}" | ||
env: "{{ chatwoot_env }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ chatwoot_sidekick_memory }}" | ||
command: ['bundle', 'exec', 'sidekiq', '-C', 'config/sidekiq.yml'] | ||
labels: | ||
traefik.enable: "false" | ||
|
||
- name: Prepare the database | ||
ansible.builtin.command: /usr/bin/docker exec {{ chatwoot_rails_container_name }} bundle exec rails db:chatwoot_prepare | ||
changed_when: false | ||
tags: molecule-idempotence-notest | ||
when: chatwoot_enabled is true | ||
|
||
- name: Stop Chatwoot | ||
block: | ||
- name: Stop Chatwoot Postgres | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_postgres_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Chatwoot Redis | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_redis_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Chatwoot Rails | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_rails_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Chatwoot Sidekick | ||
community.docker.docker_container: | ||
name: "{{ chatwoot_sidekick_container_name }}" | ||
state: absent | ||
when: chatwoot_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,15 @@ | ||
--- | ||
title: "Chatwoot" | ||
description: "About | ||
Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. 🔥💬" | ||
--- | ||
|
||
Homepage: [https://github.com/chatwoot/chatwoot](https://github.com/chatwoot/chatwoot) | ||
|
||
Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc. | ||
|
||
## Usage | ||
|
||
Set `chatwoot_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
chatwoot web interface can be found at [http://ansible_nas_host_or_ip:3022](http://ansible_nas_host_or_ip:3022). |