Field Hub serves as a central synchronisation server for Field Desktop clients.
Please refer to the wiki.
- Docker
- docker-compose
- Elixir >= 1.13
For Linux make sure to install inotify-tools
.
For Ubuntu make sure to install erlang-dev
and erlang-xmerl
.
Create an .env
file:
cp .env_template .env
If you change the default CouchDB credentials in your .env
file, make sure to also adjust config/config.exs.
Start a dockerized CouchDB:
docker-compose up
Or, if you want to run docker in the background:
docker-compose up -d
Field Hub is written in Elixir with the Phoenix Framework.
Field Hub tries to follow the Elixir and Phoenix conventions when it comes to naming and directory structure. For detailed guides please consult the official documentation.
Install dependencies:
mix deps.get
Start the server:
mix phx.server
Field Hub is now running at http://localhost:4000 as a sync target for Field Desktop. If you want to access the CouchDB directly, you can do so at http://localhost:5984/_utils.
Run unit tests with:
mix test --cover
Apply automatic formatting before committing code with:
mix format
To call functions using mix
use the pattern:
mix run -e 'FieldHub.CLI.<function_name>("<string parameter>")'
The FieldHub.CLI module implements a range of CLI functions. For example add a user by running:
mix run -e 'FieldHub.CLI.create_user("simon_hohl", "very_secret_password")'
You can run any function defined in the project this way, the CLI module just has the cleaner interface and is also viable in production.
In the commands below you should change the image names according to your institution (ghcr.io/dainst
are the official images created by the DAI).
To build a new image run:
docker build . -t ghcr.io/dainst/field_hub:latest
Alternatively, you may want to tag a new release version:
docker build . -t ghcr.io/dainst/field_hub:<MAJOR>.<MINOR>.<PATCH>
Finally you have to push the new or updated image to the registry:
docker push ghcr.io/dainst/field_hub:<version>
In order to push images, you have to authenticate your local machine with the registry, see: Github Container Registry.