Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 3.16 KB

development-setup.md

File metadata and controls

89 lines (55 loc) · 3.16 KB

Development Setup

This guide assumes you have the commands podman, go (>= 1.18), node, yarn, and make installed/available.

Targets like make start will automatically fallback to the docker command if podman is not available. The container tool command can be overriden by setting the CONTAINER_TOOL variable.

# force podman
make start CONTAINER_TOOL=podman

# force docker
make start CONTAINER_TOOL=docker

Cross-Platform Images

To build cross-platform container images you will need qemu-user-static installed.

If using MacOS you can do this with the following one-time commands:

podman machine ssh sudo rpm-ostree install qemu-user-static
podman machine ssh sudo systemctl reboot

External Traffic

To do local development with external traffic you will need a publicly-routable URL and can start localdev with PUBLIC_URL set. For example:

make start PUBLIC_URL=http://localdev.example.com

You may add additional startup commands to the Procfile.local file to have them automatically run with make start and similar commands.

ngrok: ngrok http -subdomain=localdev 3030

Database (PostgreSQL)

GoAlert is built and tested against Postgres 11. Version 9.6 should still work as of this writing, but is not recommended as future versions may begin using newer features.

The easiest way to setup Postgres for development is to run make postgres. This will start a container with the correct configuration for the dev environment.

Manual Configuration

If you already have Postgres running locally you can create the goalert role.

CREATE ROLE goalert WITH LOGIN SUPERUSER;

Currently the dev user must be a superuser to enable pgcrypto with CREATE EXTENSION.

Toolchain Requirements

  • For the first start, run make regendb to migrate and add test data into the DB (you can also scale the amount of random data with SIZE like make regendb SIZE=10). This includes adding an admin user admin/admin123.
  • To start GoAlert in development mode run make start.
  • To build the GoAlert binary run make bin/goalert BUNDLE=1.

Automated Browser Tests

To run automated browser tests, you can start Cypress in one of the following modes:

  • make cy-wide Widescreen format, in dev mode.
  • make cy-mobile Mobile format, in dev mode.
  • make cy-wide-prod Widescreen format, production build.
  • make cy-mobile-prod Mobile format, production build.

The Cypress UI should start automatically.

More information about browser tests can be found here.

Running Smoke Tests

A suite of functional/behavioral tests are maintained for the backend code. These test various APIs and behaviors of the GoAlert server component.

Run the full suite with make test-smoke.

More information about smoke tests can be found here.

Running Unit Tests

All unit tests can be run with make test-unit.

UI Unit tests are found under the directory of the file being tested, with the same file name, appended with .test.js. They can be run independently of the Go unit tests with make jest. Watch mode can be enabled with make jest JEST_ARGS=--watch.