Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 3.01 KB

README.md

File metadata and controls

64 lines (47 loc) · 3.01 KB

Development with DevContainer (VS Code)

Back to main README

When using a DevContainer, the opam packages and database files are mounted as volumes into the DevContainer.

  • .devcontainer/data/db-root/: development mariadb data (root)
  • .devcontainer/data/db-tenant/: development mariadb data (tenants)
  • Docker volume opam: opam packages
  • Docker volume build: cached build directory to speed up development

Requirements

This project is setup to run in a DevContainer. Ensure requirements to run in a DevContainer:

  1. Git installed
  2. Source Tree for GitLab setup (see Install user interface and Configure GitLab for Source Tree)
  3. Docker installed
  4. Visual Studio Code (VS Code) installed
  5. VS Code Extension Remote Container installed
  6. Set environment variable ECON_SMTP_APP_PASSWORD to our SMTP account password (see 1Password) on your local machine.

Your SSH folder and Git config gets mapped to the container. You should be able to use SSH and Git inside the container. Please ensure ~/.gitconfig doesn't contain absolute paths (you may use the ~ profile prefix, i.e. excludesfile = ~/.gitignore_global). Please note: You probably have to update Sourcetree settings. In its settings "General" tab uncheck "Allow Sourcetree to modify your global Mercurial and Git configuration files".

Start

Click on the icon similar to "><" in the bottom left corner and select Remote-Containers: Reopen in Container. If any changes were made to files in .devcontainer folder the Container should be rebuilt (Remote-Containers: Rebuild Container)

NOTE: When the setup is fully installed, select View -> Command Palette... and run the command OCaml: Restart Language Server

Running Dev Container

  • The Makefile used in the DevContainer is located in the .devcontainer folder
  • Ports from outside (e.g. localhost)
    • webserver
      • root 3016
      • tenant 3017
    • database
      • root3316
      • tenant 3317

Running Tests with Dev Container

  1. Create a .env.test file
  2. Add the following variables to it
    • DATABASE_URL=mariadb://root@database-root:3306/test
    • MYSQL_DATABASE=test_econ
  3. Run migrations and seeds for the test databases
    make test-migrate
    
  4. Run make test

Database View

There is an Adminer container added to the development package. To be able to use it, follow these few steps:

  1. Uncomment its line in the .devcontainer/devcontainer.json under runServices
  2. Use Remote-Containers: Rebuild Container that it will also create and startup the Adminer container
  3. Open your web browser and open localhost:8080