Code Monkey home page Code Monkey logo

mermaid-api's Introduction

WCS MERMAID API

Deployment

Stack

Local Development Workflow

Common workflow tasks are wrapped up using Fabric commands. Refer to fabfile.py for the current commands. Add commands as required.

Local Development Setup

Installation

This project uses Docker for configuring the development environment and managing it. By overriding the container's environment variables, the same Docker image can be used for the production service. Thus, for development work, you must have Docker installed and running.

Note that the following covers only local configuration, not deployment. See the IAC README in this repository for more information.

Environment variables

  1. copy the sample .secrets.env.sample file and fill in the blanks:
  • cp .secrets.env.sample .secrets.env
  1. copy the sample .env.sample file and fill in the blanks:
  • cp .env.sample .env

Local environment intialization

Once Docker is installed and local environment variables set, run the following:

$ fab build
$ fab up

If this is the first time running the up command, the api image will be built and postgis image will be downloaded. Then the containers will be started.

With a database already created and persisted in an S3 bucket via

$ fab dbbackup

,

$ fab dbrestore

will recreate and populate the local database with the latest dump. Without the S3 dump (i.e. running for the first time), you'll need to create a local database and then run

$ fab migrate

to create its schema.

A shortcut for the above steps, once S3 is set up, is available via:

$ fab freshinstall:[env]

env: local (default), dev, prod

Running the Webserver

Once everything is installed, run the following to have the API server running in the background:

$ fab runserver

Further

The project directory api is mounted to the container, so any changes you make outside the container (e.g. using an IDE installed on your host OS) are available inside the container.

Please note that running fab up does NOT rebuild the image. So if you are making changes to the Dockerfile, for example adding a dependency to the requirement.txt file, you will need to do the following:

$ fab down  // Stops and Removes the containers
$ fab build  // Builds a new image
$ fab up

Note: this will delete your local database; all data will be lost.

Database commands

$ fab dbbackup:<env>

env: local, dev, prod

Backup the database from a named S3 key

$ fab dbrestore:<env>

env: local, dev, prod

Related repos

The MERMAID API forms the backbone for a growing family of apps that allow for coral reef data collection, management and reporting, and visualization: https://github.com/data-mermaid

Contributing

Pull Requests welcome! When we move to Python 3 this repo will use Black. Send development questions to [email protected].

Other Topics

Collect Record

SSH into containers in the cloud

  • Install Session Manager Plugin for AWS-CLI locally
  • Ensure AWS mermaid profile is set (~/.aws/config and ~/.aws/credentials)
  • export AWS_PROFILE=mermaid
  • $ make cloud_shell
  • su webapp
  • bash

mermaid-api's People

Contributors

gridcell avatar saanobhaai avatar aspcanada avatar vpop avatar tienhoah avatar alanjleonard avatar jgnasser avatar mmnoo avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.