Skip to content

This is a mirror of the GitLab repository https://gitlab.com/open-reviews/mangrove. Please use the original for issues and pull requests.

License

Notifications You must be signed in to change notification settings

Open-Reviews/Mangrove

Repository files navigation

Mangrove

See the Demo and learn more about the project.

Work in progress!

This repository contains:

Architecture

infrastructure

Local testing

Both servers need to be up for the UI to work.

yarn and Rust compiler is needed:

Nightly compiler version is used:

rustup default nightly

Run the UI:

cd ui
yarn install
yarn dev
cd ..

Mangrove Review Server

Server relies on a Postgres database running and set up with PostGIS and Diesel:

cargo install diesel_cli --features "postgres" --no-default-features
cd servers/reviewer
diesel setup

You may also need to install libssl-dev (i.e. sudo apt install libssl-dev).

Build and run the server.

cargo run

See the API docs here.

Mangrove File Server

cd servers/file_hoster
cargo run
  • /upload: PUT a file to store it on the server, get SHA256 hash of the file if successful.
  • /: GET a file with given base64url encoded SHA256 hash from /<hash>.

Deploying to AWS Lambda

Deployment can be done using AWS CloudFormation using the Serverless Application Model. The required CloudFormation template is already set up in aws-template.yaml.

Requirements:

  • Docker
  • AWS CLI
  • An existing S3 bucket
  • libpq Lambda Layer

Adjust the name of S3 buckets in the scripts below and run:

./servers/file_hoster/deploy.sh
./servers/reviewer/deploy.sh

Run the script in .gitlab-ci.yml making sure to use your own S3 bucket.

libpq Lambda Layer

Deploying the Reviewer Lambda to AWS requires a Lambda Layer containing libpq. We host a base docker image with this layer included on Docker Hub.

To deploy your own layer, follow these instructions based on: https://github.com/DrLuke/postgres-libpq-aws-lambda-layer

git clone git@github.com:DrLuke/postgres-libpq-aws-lambda-layer.git
cd postgres-libpq-aws-lambda-layer
# Updating the submodule does not work after cloning, so just add it.
git submodule add git://git.postgresql.org/git/postgresql.git postgresql
cd postgresql
# Use the same version as one running on AWS RDS.
git checkout tags/REL_11_5
# Install missing requirements.
sudo apt install bison flex
./configure --without-readline
make
make check
cd ..
./build_layer.sh

Then deploy with

aws lambda publish-layer-version \
  --layer-name postgres-libpq \
  --zip-file fileb://aws-libpg-layer.zip \
  --compatible-runtimes provided