Dev Environment Setup#
Prereqs#
You need the following installed on your system:
default-jdkbuild-essentialmavennpmnode(minimum version: 18)docker-compose
System setup#
Run
sudo sysctl -w vm.max_map_count=262144(A requirement for OpenSearch, it only needs to be run once on your system.)Run
npm install react-app-rewiredgit cloneyour forked Wildbook repo (referred to as the code directory going forward)
Code directory setup#
In
devops/development/, create a.envfile with a copy the contents of_env.template. By default, no changes should be needed.cdto the root of the code directoryrun
npm installrun
chmod +x .husky/pre-committo enable husky lintingcd frontendrun
npm installto install all dependenciescreate a
.envfor React environment variables.Add the public URL:
PUBLIC_URL= /react/Add the site name:
SITE_NAME=My Local Wildbook
Deploy directory setup#
Create your deploy directory, matching the value of
WILDBOOK_BASE_DIRin the .env file. The default is~/wildbook-dev/)Create the necessary subdirectories
wildbook-dev
|--logs
|--webapps
|--wildbook
Build war file#
To run Wildbook in the development docker environment, even to try out the software, you need a “war file” which is made by compiling the Wildbook java project.
To create the war file:
cdto the root of the code directoryBuild your war file with
mvn clean installverify the war file was created in
target/wildbook-X.Y.Z.war(where X.Y.Z is the current version number).cd to the deploy directory
cd ~/wildbook-dev/webapps/wildbookdeploy your warfile
jar -xvf /code/directory/Wildbook/target/wildbook-X.Y.Z.war
Deploy#
cdto thedevops/developmentdirectory in the code reporun
docker-compose up [-d]To verify successful launch, open in browser
http://localhost:81/when tomcat has started. Default login of username/passwordtomcat/tomcat123should work.
Note: if you’re running docker as root, you may want to explicitly set your deploy directory path to include your user, i.e., WILDBOOK_BASE_DIR=~USER/wildbook-dev
Redeploy and rebuild#
For any local testing, you will need to rebuild and redeploy your changes.
War file#
If you make code changes and want to test them locally, you can create and deploy a new war file using the Build war file and Deploy instructions. Then use docker-compose restart wildbook to test your changes
React-only changes#
If you are working on react-only work, you can test your changes without updating the full war file. Use npm to build and deploy to your local deployment
If you have your dev environment set up correctly, this will build the React app and copy it into your local deployment directory for you.
cdtoREPO/frontend/run
npm run deploy-devrefresh your browser page by visiting either http://localhost:81/react/ for local testing or https://public.url.example.com/react/ for the public-facing deployment
Manually rebuild react-only changes#
cdtoREPO/frontend/run
npm run buildcopy everything under
frontend/build/to the deployedwildbook/react/directory you created during setuprefresh your browser page by visiting either http://localhost:81/react/ for local testing or https://public.url.example.com/react/ for the public-facing deployment
Set up WBIA#
WBIA is not covered for dev support as we are actively working to remove WBIA from the platform and move to in-app ML.
Should you want to set up a WBIA server, you can configure a single WBIA instance to run against multiple Wildbooks.