...
- 1.Clone the Datafari code
- 2. Set up your Eclipse environment
- 3. Set up your Docker environment :
- 4. Do some changes and deploy !
Pre-requisites
- Have a JDK installed on your PC/Mac (Java 8)
- Have an IDE installed on your PC/Mac (in the guide we use Eclipse) and be able to launch it as root
- Have Git installed on your PC/Mac
- Have Maven and Ant installed on your PC/Mac
- Have Docker installed on your PC/Mac
The first steps are pretty much the same than for a setup on a Linux environment. You can refer to the page for further explanations on the first steps : Setup development environment with Eclipse (Linux) for Datafari 4.x.
1. Clone the Datafari code
Open a terminal and navigate to the folder where you want to have Datafari source code to be checked out (usually your workspace folder).
Perform a
Code Block |
---|
git clone https://github.com/francelabs/datafari.git |
to checkout the code. The root directory name is datafari.
2. Set up your Eclipse environment
Build Datafari for the development environment
Navigate to the folder datafari. We now call it DATAFARI_SRC.
Run :
Code Block |
---|
mvn install' in DATAFARI_SRC |
Run :
Code Block |
---|
ant all' in DATAFARI_SRC/debian7 |
Open the project in Eclipse
In Eclipse,go to File -> Import... , type maven and « Existing Maven project ».
Select the DATAFARI_SRC folder as root directory and click Finish.
Change the permissions of the following folders :
Code Block |
---|
chmod -R 777 /opt/datafari chmod -R 700 /opt/datafari/pgsql |
To add access rights to any user on datafari installation folder. Be careful : this should be done only for the development environment and should be avoided for a production deployment!
3. Set up your Docker environment
Create a Dockerfile
Create a folder on your local PC/Mac and create a Dockerfile with this content :
...
Code Block |
---|
docker run -p 9999:8080 -p 8999:8983 -ti -v /your_datafari_code/folder/datafari-webpp/target/Datafari:/var/datafari/webapp devdatafarice bash |
Explanations :
-p 9999:8080 -p 8999:8983 -p 5601:5601 : it is the mapping between the ports that you want to expose on the container and the ports that you want to open for this on your PC/Mac to access. The first number is the local port, the second number is the port on the container.
devdatafarice : the name of the DOcker image that we build on the previous step
-ti and bash : the parameter -ti and the command bash indicate that we want to launch the container into interactive mode and launch the bash command
If the docker run command is successful, your prompt changed and you are in the /var/datafari folder.
You can now install Datafari on the container :
Code Block |
---|
dpkg -i datafari.deb |
Keep the default value for IP (127.0.0.1), choose the passwords that you want.
After that, launch Datafari :
Code Block |
---|
cd /opt/datafari/bin su demo bash bash start-datafari.sh |
You can now access to the Datafari UI !
Open your browser and access to Datafari in your localhost, the port is the port that you entered in the previous stpe ie 9999.
http://localhost:9999/Datafari
You should see the Datafari front page :
4. Do some changes and deploy
Now that we have a fully functional instance of Datafari in running state, how to deploy changes that we do on Datafari code on Eclipse on the Datafari Docker container ?
Let's do this !
- Modification on the Java code
In Eclipse, open datafari-webapp project.
...
You should see the change that you made into the developer tools when you access to the Synonyms admin UI :
- Modification on the UI
If you want to do some basic change on the UI, the previous process is not useful. We can simplify the process.
...
You should see the change that you made into the developer tools when you access to the Synonyms admin UI :
- Remote debug on Tomcat
TBD