{"id":13584585,"url":"https://github.com/reactioncommerce/proxy-traefik","last_synced_at":"2025-02-25T21:23:25.929Z","repository":{"id":45570372,"uuid":"213766023","full_name":"reactioncommerce/proxy-traefik","owner":"reactioncommerce","description":"A reverse proxy powered by Traefik for deploying the Reaction Platform on Digital Ocean","archived":false,"fork":false,"pushed_at":"2023-10-01T14:25:33.000Z","size":145,"stargazers_count":35,"open_issues_count":6,"forks_count":23,"subscribers_count":16,"default_branch":"trunk","last_synced_at":"2025-02-19T12:54:40.792Z","etag":null,"topics":["deployment","deployment-automation","digitalocean","reaction","reaction-platform","reactioncommerce","traefik"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reactioncommerce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-08T22:15:36.000Z","updated_at":"2024-04-12T20:26:52.000Z","dependencies_parsed_at":"2024-11-06T01:54:21.738Z","dependency_job_id":"9725d579-d85f-4d46-863e-38b565bc5e71","html_url":"https://github.com/reactioncommerce/proxy-traefik","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactioncommerce%2Fproxy-traefik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactioncommerce%2Fproxy-traefik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactioncommerce%2Fproxy-traefik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactioncommerce%2Fproxy-traefik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactioncommerce","download_url":"https://codeload.github.com/reactioncommerce/proxy-traefik/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240748394,"owners_count":19851256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","deployment-automation","digitalocean","reaction","reaction-platform","reactioncommerce","traefik"],"created_at":"2024-08-01T15:04:21.464Z","updated_at":"2025-02-25T21:23:25.898Z","avatar_url":"https://github.com/reactioncommerce.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# Deploy the Reaction Platform on Digital Ocean\n\n### Overview\n\nThis deployment guide's purpose is to provide a simple and easy guide on how to deploy the Reaction platform for evaluation purposes or small deployments. This guide is not meant to generate an enterprise production grade deployment. This deployment guide does not use Kubernetes, instead, Docker Compose is used to manage containers.\n\n## Table of Contents\n- [Requirements](#requirements)\n- [Reaction Services Overview](#reaction-platform-services-overview)\n- [Getting Started](#getting-started)\n- [Automated Server Configuration](#automated-server-configuration)\n    - [Prepare the Remote Host](#prepare-the-remote-host)\n    - [Prepare the Control Node](#prepare-the-control-node)\n    - [Configure the remote host to be managed with Ansible](#configure-the-remote-host-to-be-managed-with-ansible)\n    - [Generate a secure password for HTTP Basic Auth](#generate-a-secure-password-for-http-basic-auth)\n    - [Set Ansible Environment Variables](#set-ansible-environment-variables)\n    - [Execute the Playbook](#execute-the-playbook)\n    - [Create the Primary Shop](#create-the-primary-shop)\n- [Video Tutorial](#video-tutorial)\n- [Command Cheatsheet](#command-cheatsheet)\n\n### Requirements\n\n- A Linux host with at least 2GB of RAM, this guide uses a DigitalOcean droplet\n- A registered domain\n- A DNS manager that supports Certification Authority Authorization (CCA) records, such as Digital Ocean\n- Docker\n- Docker Compose\n- Git\n- Node\n- Yarn\n- Some familiarity with [Traefik](https://github.com/containous/traefik/)\n\n### Reaction Platform Services Overview\n\n###### Reaction GraphQL API\nThe [Reaction GraphQL API](https://github.com/reactioncommerce/reaction) service provides the interface to the Reaction core functionality.\n\n###### Storefront\nThe [example storefront](https://github.com/reactioncommerce/example-storefront) service provides the public facing storefront interface that customers will interact with.\n\n###### Reaction Admin\nThe [Reaction Admin](https://github.com/reactioncommerce/reaction-admin) service is a Meteor(currently being migrated off Meteor) application that provides the admin UI to manage products, orders etc. \n\n\n## Getting Started\n\nReaction services will be exposed to the public using [Traefik](https://github.com/containous/traefik/), which is a cloud native router. Traefik will act as a reverse proxy that will route traffic to Docker containers. As stated above, you will need a registered domain to complete this step, as it will be necessary to manage DNS records for it.\n\nThis guide will use the following sub-domains, where `example.com` will need to be substitute it with your domain: \n\n| subdomain              | description                           |\n| ---------------------- | ------------------------------------- |\n| api.example.com        | The Reaction  GraphQL API             |\n| storefront.example.com | The example storefront                |\n| admin.example.com      | The Reaction admin interface          |\n| traefik.example.com    | Traefik's admin UI                    |\n\nEach of your domains will need an `A` DNS record that resolves to your host's IP. It's recommend to use DigitalOcean's free [DNS manager](https://www.digitalocean.com/docs/networking/dns/overview/). Further, in order to obtain SSL certificates for your sub-domains, you will need a DNS manager that supports [CAA](https://support.dnsimple.com/articles/caa-record/) records.\n\n\nFurther, you will need a [DigitalOcean Auth token](https://docs.digitalocean.com/reference/api/create-personal-access-token/) to generate CAA records for your sub-domains.\n\n\n# Automated Server Configuration\n\nIn order to expedite the installation of server dependencies, Ansible will be used to automate most of the server configuration.\n\n###### Prepare the Remote Host\n\nIn this guide a DigitalOcean node will be used to host the Reaction Platform. If you don't yet have an account, create one at [digitalocean.com](https://digitalocean.com). Once you are signed into your account, create a new droplet using the Ubuntu 18.4 image with at least 2GB of RAM. Enable DigitalOcean's [free firewall](https://www.digitalocean.com/docs/networking/firewalls/) and add inbound rules for SSH, HTTP, HTTPS and add your droplet to the firewall.\n\nAfter the droplet is created either select an existing SSH key to login or click on the \"New SSH Key\" under the authentication section  and copy your public SSH key from your local computer.\n\nCopy the newly created IP address and verify that you can login into the new server by executing:\n\n```\nssh root@XXX.XXX.XXX.XXX\n```\n\n###### Prepare the Control Node\n\nAnsible requires a control node, which is a computer that manages a remote host. This guide will assumes a Mac laptop/desktop as the control node. \n\nInstall Ansible using [homebrew](https://brew.sh), this guide assumes some familiarity with Ansible, if you need an introduction to basic concepts click [here](https://www.ansibletutorials.com).\n\n`brew install ansible`\n\nAlso install python3 to avoid deprecation warnings,\n\n`brew install python3`\n\n###### Configure the remote host to be managed with Ansible\n\nOn the control node(i.e. a developer's machine) create an inventory file in which `python3` is specified as the interpreter. On your machine, create a new file at named `hosts` at `/etc/ansible`.\n\nCreate inventory file\n```\ntouch /etc/ansible/hosts\n```\n\nAdd the following content to the inventory file:\n```\n[servers]\nreaction.server\n\n[servers:vars]\nansible_python_interpreter=/usr/bin/python3\n[web]\n```\n\nEdit your hosts file  \n```\nsudo vim /etc/hosts\n```\n\nand add an entry for the DigitalOcean droplet,\n\n```\nXXX.XXX.XXX.XXX reaction.server\n```\n\nVerify that Ansible can communicate with your remote host by executing:\n\n```\nansible all -m ping -u root\n```\n\nYour should see output similar to:\n\n```\nreaction.dev | SUCCESS =\u003e {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n```\n\n###### Set Ansible Environment Variables\n\nBefore executing the Ansible playbook, it's necessary to set variables that are specific to your deployment. Find the\n`vars` section in the `reaction.yml` playbook and update as necessary, below is a list of the variable \nthat need to be updated and a description of each.\n\n| Variable               | Description                                                                 |\n| ---------------------- | ----------------------------------------------------------------------------|\n| do_auth_token          | The Authentication token for the Digital Ocean API                          |\n| email                  | An email address to receive SSl certificate notifications                   |\n| domain                 | Your registered domain                                                      |\n\nFor the rest of the variables, the default values should be used, DO NOT change otherwise, the playbook might fail.\n\n###### Execute the playbook\n\nNow it's time to execute the `reaction.yml` playbook, which automates most of the tedious server configuration tasks, execute the following command:\n\n```\nansible-playbook playbooks/reaction.yml -l reaction.server\n```\n\nNOTE: the `-l reaction.server` limits the execution of the playbook to the `reaction.server` host.\n\n###### Create the Primary Shop\n\nAt this point the Reaction GraphQL API, Example Storefront, Reaction Admin, Reaction Identity and Hydra should be accessible over the internet.\n\nTo create the primary shop login into the Reaction Admin at the following URL, first substitute the `example.com` with your actual domain:\n```\nhttps://admin.example.com\n```\n\nUpon navigating to the Reaction Admin interface, you will be presented with a login form, it will be necessary to create a user first, so click on the \"Register\" link and fill out the form. Once logged in, proceed to create a shop in the admin interface.\n\nFurther, the `GraphQL API` explorer will be available at `https://api.example.com/graphql`.\n\n### Video Tutorial\n\n[![Deploy the Reaction Platform on DigitalOcean](docs/img/splash.png)](http://www.youtube.com/watch?v=7g5LfEVLt1U \"Deploy the Reaction Platform on DigitalOcean\")\n\n### Command Cheatsheet\n\nThe following bash aliases are automatically added to the remote server for convenience.\n\n```\n# Docker Compose\nalias dc='docker-compose'\n\n# Bring all services down\nalias dcd='docker-compose down'\n\n# Attach to all logs of all services\nalias dcl='docker-compose logs -f'\n\n# Run a comand inside a running container\nalias dcr='docker-compose run --rm'\n\n# \"Restart\" all services\nalias dcre='docker-compose down \u0026\u0026 docker-compose up -d \u0026\u0026 docker-compose logs -f'\n\n# Bring all services up in daemon mode\nalias dcu='docker-compose up -d'\n\n# Bring all containers up and attach to their logs\nalias dcul='docker-compose up -d \u0026\u0026 docker-compose logs -f'\n\n# Remove exited containers\nalias dprune='docker ps -aq --no-trunc -f status=exited | xargs docker rm'\n\n# Show all running containers, with horizontal paging\nalias dps='docker ps -a | less -S'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactioncommerce%2Fproxy-traefik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactioncommerce%2Fproxy-traefik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactioncommerce%2Fproxy-traefik/lists"}