In this page we assume you are interested to develop new modules for Cytomine-Core (e.g. new web services, new entity in the data model,...) and/or new modules for Cytomine-IMS (e.g. support of a new image format, new image web service, ...).
If you are only interested to plug a new script of image analysis algorithm, we recommend instead to look at the [DOC] Interoperability (data & algorithms) documentation page.
We will explain all the necessary steps to configure a development environment on your computer. The idea is to install a Cytomine instance on your localhost and all the development tools/libraries required so that you can develop and test on your own computer.
Step 1 - Install the pre-requirements
Cytomine-Core and Cytomine-IMS mainly rely on Java, Groovy and the Grails framework.
Edit your .bashrc to export your JAVA_HOME:
where XXX is obtained with echo $JAVA_HOME. For example, export JAVA_HOME="/usr/lib/jvm/java7-oracle".
Then, check Java and Groovy version:
If you prefer, you can visualize the installation with screenshots here.
Step 2 - Install an integrated development environment
We recommend to use Intellij IDEA Ultimate Edition. The following considers it is the case.
Download Intellij IDEA Ultimate Edition on their website: https://www.jetbrains.com/idea/download/#section=linux
Install it :
If you prefer you can visualize the installation with screenshots here.
Step 3 - Retrieve source code
Download our source code in a local directory (e.g. $HOME/Cytomine/) by cloning Cytomine-core and Cytomine-IMS from our source repository:
Step 4 - Configure projects in Intellij
Import the Cytomine-Core and Cytomine-IMS source project into Intellij, by choosing Maven as external model to import the projects.
Choose the right JDK version.
If needed, right click on the project (left menu) and choose "Add Framework support" to select Groovy.
If Grails SDK is not found (see Event Log), click on "Configure SDK Home". The path is given by
If the source root of the project is not detected, in the Project panel on left, right click on
grails-app folder and then Mark Directory as > Source root.
For more detailed importation of projects if you are not familiar with Intellij, see the screenshots on this page.
Step 5 - Create a Dockerized development environment.
One of the main interest of Docker is to have the same environment between developers and final users.
In order to do this and to avoid installation of an additional local machine, we will setup a Dockerized development environment. Follow the two first points of an Automatic Installation with Docker (Download Cytomine-bootstrap and install Docker).
Step 6 - Install IMS required libraries (if needed).
If you want develop on IMS, the IMS will run on your machine and you will need all the dependencies of IMS : tiffinfo, identify, vips. You can find into the Dockerfile of IMS the way to install these dependancies. The following commands should be enough to get the related libs:
Step 7 - Update the bootstrap procedure.
Then, in the Bootstrap folder you have downloaded at step 5, make the following changes :
1) In the
nginx/deploy.sh file, replace the lines
2) If you develop IMS, in the
nginx/nginx.conf.sample, replace the line
3) In the
restart_keep_data.sh, replace the lines
6) If you develop IMS, in the
clean_docker_keep_data.sh, add the lines
Step 8 - Update your /etc/hosts
Don't forget to update it, if you deploy on local host. If you kept the default configuration, update your
Step 9 - Last modifications to your IDE
The last modifications need to be done in your development environment (IDE).
In your Cytomine-Core project:
- In the
Cytomine-core/grails-app/conf/Config.groovyfile of your Cytomine-core project,
- update the value
grails.serverURL(development part) by " ".
- update the public and private keys of admin, superAdmin, and ImageServer users. You can run the cat
/proc/sys/kernel/random/uuidcommand to generate keys
- update the value grails.adminPassword by the default password of the admin user and add the retrievalUsername and retrievalPassword (default : cytomine and retrieval_default)
- update the value
DataSource.groovyfile into the Core project, update the value username and password (development part) by "docker" and the url by "jdbc:postgresql://localhost:5432/docker".
In IntelliJ, in the "Run" menu toolbar, Go to "Edit configurations" edit the Command Line by "
-reloading -Dserver.port=8080 run-app -echoOut --stacktrace -nocoverage --verbose"
In your Cytomine-IMS project:
- In the
- update the public and private keys of admin, superAdmin, and ImageServer users with the keys generated at previous step.
- as long as the database is not Dockerized, update the the cytomine.imageServerPrivateKey and cytomine.imageServerPublicKey values by the private and public keys of the username 'ImageServer1' (in the sec_user table) in the database.
- In IntelliJ, in the "Run" menu toolbar, Go to "Edit configurations" edit the Command Line by "
-reloading -Dserver.port=9080 run-app -echoOut --stacktrace -nocoverage --verbose".
Step 10 - Start Docker containers and develop
In Cytomine-boostrap directory, you can now run the script start_dev.sh. This will deploy the Docker containers:
In IntelliJ, you can now run the Cytomine-core project that will simulate a server at the grails.serverURL mentionned above. So in this example you can now access the core development server at http://CORE_URL:8080 to test your core dev environment. It will rely on other containers installed by Docker but use your own core (and IMS) development container(s).
To restart the docker containers while keeping data, use:
- If you encounter a "
java.lang.OutOfMememoryError: PermGen space" error, add the option
-XX:+CMSClassUnloadingEnabledto the JVM, when running Cytomine-Core. In Intellij, go to Run > Edit Configurations and add it in the VM options field.
If you have an error "
org.codehaus.groovy.grails.commons.ConfigurationHolder: class not found" when compiling Cytomine-IMS, edit the file
~/.grails/2.4.4/projects/IMS/plugins/background-thread-1.6/BackgroundThreadGrailsPlugin.groovy, by replacing
As nginx will try to contact your machine, you may need to allow docker containers to contact port 8080 & 9080. Here is the command with UFW