Skip to content

Didstopia/docker-realm-object-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Realm Object Server (Developer Edition) for Docker

Build Status Join the chat at https://gitter.im/Didstopia/docker-realm-object-server

Provides a clean, easy and up to date way to run Realm Object Server inside a Docker container.

How is this different?

In a nutshell: this project is fully automated.

In addition to testing the latest version of Realm Object Server, we also generate new tags on both GitHub and Docker Hub, all on a daily basis, so everything is always up to date and properly tested.

Note that the latest tag should not be used. Instead, use a specific version of Realm Object Server, as that it is both safer and more stable when running in a production environment.

Basic Usage

Sample usage:

docker run -d -p 9080:9080 -p 9443:9443 -v /srv/realm/data:/var/lib/realm/object-server -v /srv/realm/config:/etc/realm -v /srv/realm/auth:/usr/local/lib/realm/auth/providers --name realm-object-server didstopia/realm-object-server:1.8.3-83

When the image runs for the first time, it will create both a configuration.yml file under /etc/realm, as well as SSH keys for Realm Object Server.

By default, only HTTP is enabled (port 9080), so you'll probably want to edit the config file to, for example, only enable HTTPS (port 9443).

Using npm modules

Realm Functions can use Node.js/npm modules, but they need to be installed first.

You can specify an environment variable called REALM_NPM_MODULES with a value of comma separated npm modules you want to install and keep up to date, eg. REALM_NPM_MODULES="request,mongoose".

You can also specify versions for the modules, just like you would when using npm install, eg. REALM_NPM_MODULES="mongoose@4.11.13".

Backup/Restore

By default, the Realm database is backed up to /backups once a day. Currently the backup script only works if the database exists at /var/lib/realm/object-server.

As automated backups are still a work in progress, you need to specifically enable automatic backups by setting the environment variable ENABLE_BACKUPS="true".

Troubleshooting

If you get Error: Failed to resolve ':::9080', then you don't have IPv6 enabled (which you should have). If you for some reason can't enable IPv6, then you have to edit configuration.yml, replacing listen_address: '::' with listen_address: '0.0.0.0'.

Contributing/Development

Before you begin you'll need the following:

  • httpie
  • jq
  • packagecloud.io API token

You should be able to follow the logic in .travis.yml for setting up the environment, as well as for building the image. Do note that the Dockerfile and the scripts contain special logic for handling production vs. test builds.

Create a file named .env, which currently supports the following environment variables:

PACKAGECLOUD_API_TOKEN=
REALM_VERSION=

Note that overriding REALM_VERSION is optional, and will otherwise query the packagecloud.io API for the latest version. Overriding this is useful when you want to work with a specific version, and not worry about a potential new version coming out at the same time.

You can skip the packagecloud.io API query for the version by setting REALM_VERSION to a valid ROS version.

PRs and issue submission are very welcome, and will be merged/fixed in a timely fashion.

Alternatively you can build and run a development build with the following commands:

docker build -t didstopia/realm-object-server:development-test . && \
BUILDID=`docker history didstopia/realm-object-server:development-test | grep "LABEL TEST=FALSE" | awk '{print $1}'` && \
docker tag $BUILDID didstopia/realm-object-server:development && \
docker run -it --rm -p 9080:9080 -p 9443:9443 -v $(pwd)/data/var/lib/realm-object-server:/var/lib/realm/object-server -v $(pwd)/data/etc/realm:/etc/realm -v $(pwd)/data/usr/local/lib/realm/auth/providers:/usr/local/lib/realm/auth/providers -v $(pwd)/data/backups:/backups --name realm-object-server didstopia/realm-object-server:development

Licenses

This project is provided under the MIT License.

The following license also apply to this project: