Dev Environment Setup#
Prereqs#
You need the following installed on your system:
default-jdk
build-essential
maven
npm
node
(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-rewired
git clone
your forked Wildbook repo (referred to as the code directory going forward)
Code directory setup#
In
devops/development/
, create a.env
file with a copy the contents of_env.template
. By default, no changes should be needed.cd
to the root of the code directoryrun
npm install
run
chmod +x .husky/pre-commit
to enable husky lintingcd /frontend
run
npm install
to install all dependenciescreate a
.env
for 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_DIR
in 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:
cd
to the root of the code directoryBuild your war file with
mvn clean install
verify 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/wildbook
deploy your warfile
jar -xvf /code/directory/Wildbook/target/wildbook-X.Y.Z.war
Deploy#
cd
to thedevops/development
directory 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
/tomcat123
should 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.
cd
toREPO/frontend/
run
npm run deploy-dev
refresh 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#
cd
toREPO/frontend/
run
npm run build
copy 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