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.
- Loading branch information
Showing
11 changed files
with
237 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 |
---|---|---|
|
@@ -198,6 +198,10 @@ | |
tags: | ||
- esphome | ||
|
||
- role: evershop | ||
tags: | ||
- evershop | ||
|
||
- role: excalidraw | ||
tags: | ||
- excalidraw | ||
|
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,35 @@ | ||
--- | ||
evershop_enabled: false | ||
evershop_available_externally: false | ||
|
||
# directories | ||
evershop_data_directory: "{{ docker_home }}/evershop" | ||
|
||
# network | ||
evershop_port: "3023" | ||
evershop_hostname: "evershop" | ||
evershop_network_name: "evershop" | ||
|
||
# specs | ||
evershop_memory: 1g | ||
evershop_postgres_memory: 1g | ||
|
||
# docker | ||
evershop_container_name: evershop | ||
evershop_postgres_container_name: evershop-db | ||
evershop_image_name: "evershop/evershop" | ||
evershop_image_version: latest | ||
evershop_postgres_image_name: "postgres" | ||
evershop_postgres_image_version: "16" | ||
evershop_user_id: "1000" | ||
evershop_group_id: "1000" | ||
|
||
# evershop | ||
evershop_db_name: "evershop" | ||
evershop_db_username: "evershop" | ||
evershop_db_password: "secure" | ||
evershop_db_host: "{{ evershop_postgres_container_name }}" | ||
evershop_db_port: "5432" | ||
evershop_admin_email: "admin@{{ ansible_nas_domain }}" | ||
evershop_admin_name: "admin" | ||
evershop_admin_password: "supersecure" |
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 @@ | ||
# Evershop | ||
|
||
Homepage: [https://github.com/evershopcommerce/evershop](https://github.com/evershopcommerce/evershop) | ||
|
||
NodeJS E-commerce Platform | ||
|
||
## Usage | ||
|
||
Set `evershop_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
evershop web interface can be found at [http://ansible_nas_host_or_ip:3023](http://ansible_nas_host_or_ip:3023). |
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 | ||
privileged: true | ||
pre_build_image: true | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
evershop_enabled: true | ||
evershop_data_directory: /tmp/evershop |
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: | ||
evershop_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,26 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get evershop postgres container state | ||
community.docker.docker_container: | ||
name: "{{ evershop_postgres_container_name }}" | ||
register: result_db | ||
|
||
- name: Get evershop container state | ||
community.docker.docker_container: | ||
name: "{{ evershop_container_name }}" | ||
register: result | ||
|
||
- name: Check if evershop containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result_db.container['State']['Status'] == "running" | ||
- result_db.container['State']['Restarting'] == false | ||
- 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,26 @@ | ||
--- | ||
- 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 evershop postgres | ||
community.docker.docker_container: | ||
name: "{{ evershop_postgres_container_name }}" | ||
state: absent | ||
register: result_db | ||
|
||
- name: Try and stop and remove evershop | ||
community.docker.docker_container: | ||
name: "{{ evershop_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if evershop is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result_db.changed | ||
- 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,93 @@ | ||
--- | ||
- name: Start Evershop | ||
block: | ||
- name: Create evershop Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ evershop_data_directory }}" | ||
|
||
- name: Create Evershop network | ||
community.docker.docker_network: | ||
name: "{{ evershop_network_name }}" | ||
|
||
- name: Create Evershop Postgress Docker Container | ||
community.docker.docker_container: | ||
name: "{{ evershop_postgres_container_name }}" | ||
image: "{{ evershop_postgres_image_name }}:{{ evershop_postgres_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ evershop_data_directory }}/database:/var/lib/postgresql/data:rw" | ||
networks: | ||
- name: "{{ evershop_network_name }}" | ||
network_mode: "{{ evershop_network_name }}" | ||
container_default_behavior: no_defaults | ||
env: | ||
POSTGRES_PASSWORD: "{{ evershop_db_password }}" | ||
POSTGRES_USER: "{{ evershop_db_username }}" | ||
POSTGRES_DB: "{{ evershop_db_name }}" | ||
PG_DATA: /var/lib/postgresql/data | ||
labels: | ||
traefik.enable: "false" | ||
restart_policy: always | ||
memory: "{{ evershop_postgres_memory }}" | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -d {{ evershop_db_name }} -U {{ evershop_db_username }}"] | ||
start_period: 20s | ||
interval: 30s | ||
retries: 5 | ||
timeout: 5s | ||
|
||
- name: Create Evershop Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ evershop_container_name }}" | ||
image: "{{ evershop_image_name }}:{{ evershop_image_version }}" | ||
pull: true | ||
volumes: | ||
- "{{ evershop_data_directory }}/data/config:/app/config:rw" | ||
- "{{ evershop_data_directory }}/data/media:/app/media:rw" | ||
- "{{ evershop_data_directory }}/data/public:/app/public:rw" | ||
- "{{ evershop_data_directory }}/data/themes:/app/themes:rw" | ||
networks: | ||
- name: "{{ evershop_network_name }}" | ||
network_mode: "{{ evershop_network_name }}" | ||
ports: | ||
- "{{ evershop_port }}:3000" | ||
env: | ||
DB_HOST: "{{ evershop_db_host }}" | ||
DB_PORT: "{{ evershop_db_port }}" | ||
DB_PASSWORD: "{{ evershop_db_password }}" | ||
DB_USER: "{{ evershop_db_username }}" | ||
DB_NAME: "{{ evershop_db_name }}" | ||
NODE_ENV: production | ||
restart_policy: unless-stopped | ||
memory: "{{ evershop_memory }}" | ||
labels: | ||
traefik.enable: "{{ evershop_available_externally | string }}" | ||
traefik.http.routers.evershop.rule: "Host(`{{ evershop_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.evershop.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.evershop.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.evershop.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.evershop.loadbalancer.server.port: "3000" | ||
|
||
- name: Create new admin user | ||
community.docker.docker_container_exec: | ||
container: "{{ evershop_container_name }}" | ||
command: npm run user:create -- --email "{{ evershop_admin_email }}" --password "{{ evershop_admin_password }}" --name "{{ evershop_admin_name }}" | ||
tags: molecule-idempotence-notest | ||
when: evershop_enabled is true | ||
|
||
- name: Stop Evershop | ||
block: | ||
- name: Stop Evershop postgres | ||
community.docker.docker_container: | ||
name: "{{ evershop_postgres_container_name }}" | ||
state: absent | ||
|
||
- name: Stop Evershop | ||
community.docker.docker_container: | ||
name: "{{ evershop_container_name }}" | ||
state: absent | ||
when: evershop_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,14 @@ | ||
--- | ||
title: "Evershop" | ||
description: "NodeJS E-commerce Platform" | ||
--- | ||
|
||
Homepage: [https://github.com/evershopcommerce/evershop](https://github.com/evershopcommerce/evershop) | ||
|
||
NodeJS E-commerce Platform | ||
|
||
## Usage | ||
|
||
Set `evershop_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
evershop web interface can be found at [http://ansible_nas_host_or_ip:3023](http://ansible_nas_host_or_ip:3023). |