Local testing

Many pull requests can be tested by using the Netlify link in the PR, but you must run a branch locally to test branches/releases that include changes to the database.

🧰 Initial setup

Clone the repo

If you don't have one, create a directory for Github repos: $ mkdir ~/Documents/GitHub

From your repo directory, clone Moped: $ git clone https://github.com/cityofaustin/atd-moped

Install Docker & Docker Compose

Follow the docker documentation to install docker in your system.

Install the Hasura CLI

Run $ curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash.

This will install the Hasura CLI in /usr/local/bin. You might have to provide your sudo password depending on the permissions of your /usr/local/bin location.

Install nvm

We use Node Version Manager (nvm) to keep our node versions in sync with our environments.

  1. Install the Xcode Command Line Developer Tools: $ xcode-select --install

  2. Install nvm according to the directions on their website.

  3. From the moped editor directory, activate the current node and npm version required for this project: $ nvm use

  4. Install dependencies: $ npm install

🛵 Running Moped

Update your local code

From the atd-moped directory, run $ git fetch to download the most recent code, files, and branches from Github. If you want to test a branch other than main, run $ git checkout <branch-name>.

You may be notified that your local code is behind the current state of the branch. Use $ git pull to update.

Open Docker

You don't need to actively do anything with Docker Desktop, but you need the application running.

You can disable the default "Open Docker Dashboard when Docker Desktop starts" setting if you don't want a window to pop up. Instead, just click the Docker logo in the Finder menu bar to see the green dot and "Docker Desktop is running" status.

Start the database

Our tool hasura-cluster provides shortcuts for the Hasura commands we need frequently in Moped.

  1. Start the cluster: $ ./hasura-cluster start

  2. Optionally, open the Hasura console in your browser: $ ./hasura-cluster console or $ hasura console

Start the application

  1. In a second Terminal tab, from the moped editor directory, run $ npm install to ensure that any new packages are installed.

  2. Start the server: $ npm run start

  3. Open https://localhost:3000/moped in your browser.

  4. To login, locate the username and pw in the DTS password store under the named "Moped Test Editor (local, staging, prod)."

Switching branches

When testing multiple PRs in a sitting, you need to run $ ./hasura-cluster restart every time you check out a new branch. You shouldn't need to re-run $ npm install or log out of Moped.

🛑 When you're finished

  1. In the Terminal tab running the application, end the npm process by typing Ctrl+C.

  2. In the Terminal tab with the database, close the Hasura console (if running) by typing Ctrl+C. Then stop the database: $ ./hasura-cluster stop

Last updated