Skip to main content

Deployment

How to deploy Fridge Bridge

To deploy Fridge Bridge you'll need to:

  • Install Ansible
  • jq
  • Have a debian based server with inbound roules open for ports 80 (HTTP), 443(HTTPS) and 22 (SSH).

First, you need to add your host to ansible. For that add a new entry to /etc/ansible/hosts/:

[GROUP]
<NAME> ansible_host=<YOUR_HOST_IP>

For example:

[fridge-bridge]
fridge-bridge-1 ansible_host=<YOUR_HOST_IP>

Next, change the json deploy configuration with the appropriate parameters, here is what the config looks like:

{
"host": "<YOUR_HOST>",
"host_ansible": "<ANSIBLE_HOST_NAME>",
"user": "<HOST_USER>",
"email": "<MAIL>",
"domain_name": "<YOUR_DOMAIN_NAME>",
"postgres_url": "",
"postgres_db": "",
"postgres_user": "",
"postgres_password": "",
"rabbitmq_user": "",
"rabbitmq_password": "",
"jwt_pub_key": "",
"jwt_priv_key": "",
"sendgrid_api_key": "",
"company_mail": "",
"google_oauth_client_id": "",
"google_oauth_secret": "",
"github_oauth_client_id": "",
"github_oauth_secret": ""
}

Notes:

  • host: refers to the hostname of the host (what you used when doing ssh user@hostname).
  • host_ansible: refers to the ansible host name you have set in the previous step.
  • user: refers to the host machine user.
  • domain_name: the domain that is pointing to the host machine, for example: fridgebridge.simplecharity.com.
  • email: this email is used when setting the certificate. You'll receive notifications about the state of your site certification here.
  • You can generate a pair of jwt keys by running: make gen_jwt_ecdsa_keys

Once you have modified the config file, from the project root run:

make deploy

This will:

  • Install all the basic tools, deps for building the project
  • Start systemd services for postgres, rabbit, the java server and the docs.
  • It will start a proxy server with nginx on ports :80 and :443.

Finally, check that the setup went well by going to your domain at:

  • https://<domain_name>: you should see the fridge bridge client
  • https://<domain_name>/docs: you should see the fridge bridge documentation

If anything goes wrong, you can re-run the target or only the ones that failed.

See logs

To see the logs in the server run:

journalctl -xefu java_server

Update your host

If you have already deployed fridge bridge, upgrading your host to the latest release is straightforward, just from the project root run:

make deploy-upgrade HOST=<YOUR_HOST>

This will ssh into your host and restart the systemd-services which will trigger a recompilation.