Sign inSign up

fmnd/formio-docker

By fmnd

Updated almost 7 years ago

Docker container for [Form.io](https://form.io)'s open-source [API Server]

Image
2

50K+

fmnd/formio-docker repository overview

Formio API Server Docker Container

Docker container for Form.io's open-source API Server based on Alpine Linux.

Usage

To use this container, just pull the latest docker hub image from unfao/formio.

  1. Create an external network
docker network create formio
  1. Create the mongo instance (OPTIONAL)

You may skip this step and specify the mongodb connection string to the formio container instead using the MONGO environment variable.

docker run -itd  \
  --name formio-mongo \
  --network formio \
  --volume /opt/mongodb:/data/db \
  --restart unless-stopped \
  mongo;
  1. Create the formio instance (remember to remove the mongo link if not using it).

IMPORTANT The listening port must be the same as the port defined in the HOST variable.

docker run -itd \
    -e "DOMAIN=https://lvh.me" \
    -e "[email protected]" \
    -e "ROOT_PASS=admin.123" \
    -e "USER_FORM=admin" \
    -e "USER_LOGIN_FORM=admin/login" \
    -e "MONGO=mongodb://formio-mongo:27017/formioapp" \
    -e "MONGO_SECRET=CHANGEME" \
    -e "JWT_SECRET=CHANGEME" \
    -e "PROTOCOL=http" \
    -e "HOST=localhost:8080" \
    --name formio-api \
    --network formio \
    --link formio-mongo:mongo \
    --restart unless-stopped \
    -p 8080:3001 \
    unfao/formio
Build

To build this docker container just clone the repository and build it to your liking using docker-compose.

git clone https://github.com/un-fao/fast-docker.git         # clone the repository
cd ./fast-docker                                       
cp template.env ./.env                                      # modify and save the .env file
docker-compose up -d                                        # fire-up the docker container

Environment Configuration

The file template.env is provided as template for setting up the environment variables. Once ready, save it as .env to build the docker image.

Docker Configuration

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

SettingDescriptionExample
NETWORKThe docker external network to attach the container.formio
PORTThe port for accessing the API server.8443
PROJECT_TEMPLATEThe project template variation to use (leave empty for default template).default
ROOT_EMAILThe default root account email used when installing the Form.io API server.[email protected]
ROOT_PASSThe default root account password used when installing the Form.io API server.admin.123
MONGOThe MongoDB connection string to connect to your remote database.mongodb://formio-mongo:27017/formioapp
MONGO_SECRETThe database encryption secret.FTFaVuIdSv4Hj2bjnwae
MONGO_HIGH_AVAILABILITYIf your database is high availability (like from Mongo Cloud or Compose), then this needs to be set.1
JWT_SECRETThe secret password for JWT token encryption.YilQ9E1wOiITdWOeaMCL
JWT_EXPIRE_TIMEThe expiration for the JWT Tokens.240
EMAIL_TYPEThe default email transport type (sendgrid or mandrill).sendgrid
EMAIL_USERThe sendgrid api_user string.sendgrid-user
EMAIL_PASSThe sendgrid api_key string.sendgrid-pass
EMAIL_KEYThe mandrill apiKey string.mandrill-key
EMAIL_OVERRIDEProvides 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"}}}

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.default.json
    |--- project.full.json

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

PROJECT_TEMPLATE=full

If the install script fails to find the defined project, it will use Form.io's default project.

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.

Authors

License

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

Tag summary

Content type

Image

Digest

Size

158.9 MB

Last updated

over 7 years ago

docker pull fmnd/formio-docker