GithubHelp home page GithubHelp logo

fast-platform / fast-docker-api Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 173 KB

Form.io API Server Docker Image

License: MIT License

JavaScript 17.12% Shell 73.45% R 0.07% Dockerfile 8.08% Makefile 1.28%
docker docker-compose formio

fast-docker-api's Introduction

Docker suite for the FAST project

Full Docker Backend for the FAST project

Includes Form.io's open-source API Server based on Alpine Linux.

What is FAST?

FAO SURVEY TECHNOLGY (FAST) is the Food and Agriculture Organization's approach to handle corporate Data Collection and Data Management projects in a scalable and reusable fashion. Rather than just going for a single provider approach, we separated every step of the Data Collection process to allow the use of pluggable/interchangeable Open Source solutions that will work the same way whether you are using them on a Cloud or On-premise environment (No internet access)

Usage

Docker compose

alt text

To start using this docker container just clone the repository and build it using docker-compose

git clone https://github.com/un-fao/fast-docker-api.git       # clone the repository
cd ./fast-docker-api
cp env-example ./Deploys/Compose/.env                         # modify and save the .env file
make deploy-compose                                           # fire-up the docker container

Docker swarm (under dev)

alt text

To start using this docker container with Docker Swarm

git clone https://github.com/un-fao/fast-docker-api.git       # clone the repository
cd ./fast-docker-api
make deploy-swarm                                             # fire-up the docker container

ARCHITECTURE (roadmap)

alt text

Environment Configuration

The file env-example is provided as template for setting up the environment variables. Once ready, save it as .env to start the full stack

Docker Configuration

These are some of the environment variables available for configuring the Form.io docker container. Check env-example. For more examples check the custom-environment-variables.json to see how they map themselves into the API server configuration.

Docker

Setting Description Example
DATA_PATH_HOST Storage path on your machine. For all storage systems ../../data/compose
NETWORKS_DRIVER The docker network to attach the container bridge
VOLUMES_DRIVER The volume to attach the containers local

Formio

Setting Description Example
FORMIO_PROTOCOL The protocol used to connect to the formio container (default = http) http
FORMIO_HOST The host used to connect to the formio container (default = localhost) localhost
FORMIO_PORT The port used to connect to the formio container (listening port) 3001
PROJECT_TEMPLATE The project template to use (leave empty or use default to use default Form.io template). default
ROOT_EMAIL The default root account username used when installing the Form.io API. [email protected]
ROOT_PASS The default root account password used when installing the Form.io API. [email protected]
MONGO The MongoDB connection string to connect to your remote database. mongodb://user:user@mongo:27017/fast
MONGO_SECRET The database encryption secret. FTFaVuIdSv4Hj2bjnwae
MONGO_HIGH_AVAILABILITY If your database is high availability (like from Mongo Cloud or Compose), then this needs to be set. 1
JWT_SECRET The secret password for JWT token encryption. YilQ9E1wOiITdWOeaMCL
JWT_EXPIRE_TIME The expiration for the JWT Tokens. 240
EMAIL_TYPE The default email transport type (sendgrid or mandrill). sendgrid
EMAIL_USER The sendgrid api_user string. sendgrid-user
EMAIL_PASS The sendgrid api_key string. sendgrid-pass
EMAIL_KEY The mandrill apiKey string. mandrill-key
EMAIL_OVERRIDE Provides a way to point all Email traffic to a server (ignores all other email configurations). {"transport":"smtp","settings":{"port":2525,"host":"smtp.mailtrap.io","auth":{"user":"23esdffd53ac","pass":"324csdfsdf989a"}}}
What you get

After the default deploy you will get Form.io Community running on port 3001 (http) alt text

And you will have full access to the Form.io API as usual alt text

MONGODB

Setting Description Example
MONGO_PORT Port to start the mongodb service. 27017
MONGO_ROOT_USERNAME Name of the root (admin) user admin
MONGO_ROOT_PASSWORD Password of the root (admin) user admin
MONGO_DB_NAME Name of the database to create fast
MONGO_DB_USER Name of the main user of the created DB user
MONGO_DB_PASSWORD Password of the main user of the created DB user
What you get

After the default deploy you will have MongoDB running on your localhost and port 27017

server: localhost
port: 27017
username: user
password: user
DB: fast

alt text

OpenCpu

Setting Description Example
OPENCPU_PORT_HTTP The OpenCpu http port 8085
OPENCPU_PORT_HTTPS The OpenCpu http port 8086
What you get

After the default deploy you will have OpenCpu running on port 8085.

You will be able to access the OpenCpu test api using localhost:8085/ocpu alt text

Or directly access the OpenCpu Rstudio implementation localhost:8085/rstudio

Remember that the default credentials for OpenCpu are:

Username: opencpu
password: opencpu

Don´t forget to change them!

Installing packages while running

If you didn't install all the packages you need while deploying the container, you can install them at any time by accessing the container

docker exec -i -t <container_id_or_name>  /bin/bash
R -e 'install.packages(c("package1", "package2"))'

Or from outside

docker exec -it <container_id_or_name> echo "R -e 'install.packages(c("package1", "package2"))'"

alt text

KONG

All routes for the different services are handeled from Kong API gateway. You can use KONGA UI to manage them or to add more!

alt text

By doing this, you dont longer query directly the Form.io API server, but use the "/formio" KONG gateway instead alt text

NetData

Setting Description Example
NETDATA_PORT The NetData port 19999
What you get

Want to see how your machine is performing? No problem just access Netdata on localhost:19999 alt text

Portainer

Setting Description Example
PORTAINER_PORT The Portainer port 9010
What you get

Want to check your full docker-compose cluster status? Go to Portainer localhost:9010 alt text

Project Templates

To include a custom project template, save it on the templates directory using the following naming convention: project.<id>.json (e.g.: project.basic.json). To install a specific template, set the PROJECT_TEMPLATE value to the templates <id>. The default id is reserved for Form.io's default project template. All projects templates should use Form.io's Project JSON Schema.

Example

You may have multiple project templates in your templates directory.

--- templates
    |--- project.basic.json
    |--- project.full.json

Then on your .env file you just need to specify which template to use:

PROJECT_TEMPLATE=full

If the mongodb database defined in the mongo connection string does not exist, then a new project will be initialized using the given project template.

Changing the Dockerfiles

If you want to manually apply changes to one of the Dockerfiles dont forget to manually build the image using: docker-compose build

docker-compose build formio

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

fast-docker-api's People

Contributors

airarrazaval avatar cabrerabywaters avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.