Skip to content

Elemento-Modular-Cloud/elemento-marketplace-web

Repository files navigation

Elemento marketplace

Specs

  • Container FTP

    • User: admin
    • Pass: change_me
    • ftp://admin:change_me@leader_node_ip
  • One or more containers DB MariaDB with dashboard phpmyadmin

  • Container to execute cronjob

  • One or more containers for mail server with dashboard Docker Mailserver

  • Container front-end (webserser) (nginx)

  • Container reverse proxy with SSL traefik

  • Container PHP FPM - v7 or later

  • Portainer

  • traefik

    • NOTE: the acme.json file must be set with the 600 permission
  • homepage

  • homepage autoconfig (traefik-discovery)

    • NOTE: the services.yaml must be set with the 600 permission
    • The container is reachable only inside the docker network, use crontab to do the update (or refresh) of services, here the command:
    curl -X POST services-discovery:5001/api/v1/homepage/update
    or
    curl -X POST services-discovery:5001/api/v1/homepage/refresh (delete and recreate all services)
    

Environment variables

In order to change the default values and password of the docker compose, you can create a .env file in the root of the project and set the variables you want to change. .env.template can be used as a template renaming it to .env.

System design

System design

Starting the Stack

Define an .env file in order to set the environment variables of ftp server, mariadb and phpmyadmin.
To start the stack using docker stack deploy, run the following command with admin privileges:

chmod -R 755 php
chmod 600 traefik/acme.json
chmod 600 homepage/config/services.yaml
docker network create --driver overlay net
docker stack deploy --compose-file docker-compose.yml web

A setup script is available in the scripts folder in order to

  • customize the hostname in the docker compose;
  • set the credentials (of traefik basic auth) for the services;
  • setup the permissions of the acme.json and services.yaml files;
  • create the network (optional);
  • deploy the stack (optional).
python3 scripts/setup.py <customer_name> <password> [-p] [path] [-n] [-d] [stack_name] [-h]
  1. customer_name: used to customize the hostname and to define the username for the basic auth
  2. password: for the basic auth
  3. -p or --path: pass the path to use in order to go to the root of the project
  4. -n or --network: to create the docker network
  5. -d or --deploy: to deploy the stack
  6. stack_name: the name of the stack (default: production)
  7. -h or --help

Ansible playbook

ansible-playbook playbook.yaml -e "customer=my_customer traefik_password=my_password deploy=-d"

Start the Mail service (Server side)

Start the swarm and run the following command to add a user to the mail server (mandatory):

docker exec -ti <container-name> setup email add [email protected]

Start the Mail service (Client side)

To configure the mail client, use the following settings for Thunderbird: Open the Thunderbird client and go to the Account Settings: Thunderbird settings Select email esistente, Insert the name, email and password:

IMAP email.web.elemento.cloud STARTSSL 143

SMTP email.web.elemento.cloud 587

Then, select Configura manualmente: Thunderbird settings Select Fatto and accept the menu pop-up.

Conventions

In Elemento we use Google Style coding conventions.