Development Setup
This guide will walk you through setting up HydroServer for local development.
Contributing
This guide is for setting up a local development instance of HydroServer which may be useful if you fork our repository and need to modify code. HydroServer is open source, and if you'd like to contribute directly to our repository, checkout our contributing guide.
Prerequisites
Before starting, make sure you have the following software installed on your machine:
- Python 3.11+
- Docker
- Node.js: The frontend uses various Node.js libraries. Check the package.json for specific version requirements.
- npm (typically bundled with Node.js): This is required to install the project's dependencies.
NGINX Reverse Proxy and Development Database
Installation
- Clone the repository:bash
git clone https://github.com/hydroserver2/hydroserver.git cd hydroserver/deploy/dev - Create environment variables for static and media file paths. The default locations of these folders should be
/staticand/mediawithin thehydroserverproject folder. Mac/Linux:bashWindows:export HS_MEDIAFILES="/path/to/media" export HS_STATICFILES="/path/to/static"cmdset HS_MEDIAFILES=C:\path\to\media set HS_STATICFILES=C:\path\to\static - Start Docker containers. All services can be accessed in a browser at
http://localhost.bashdocker compose --file "docker-compose.yaml" up
Installation
- Clone the repository:bash
git clone https://github.com/hydroserver2/hydroserver.git cd hydroserver
HydroServer Backend Setup
Installation
- Navigate to
djangoand install the dependencies:bashcd django pip install -r requirements.txt - Create a .env file and update variables as needed. For getting started, the default settings should be sufficient.
- Perform database migrations and collect static files:bash
python manage.py migrate python manage.py collectstatic - Create an admin user and load test data.bash
python manage.py createsuperuser python manage.py load_iam_test_data python manage.py load_sta_test_data - Start the Django development web server:bash
python manage.py runserver
HydroServer Frontend
Installation
- Navigate to
apps/data-managementand install the required packages:bashcd hydroserver-data-management-app npm install - Create a .env file and update variables as needed. For getting started, the default settings should be sufficient.
- Build the static files and run the application in production mode:bashor developer mode
npm run build npm run previewbashnpm run dev
