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/docker/develop
- Create environment variables for static and media file paths. The default locations of these folders should be
/static
and/media
within thehydroserver-api-services
project 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
HydroServer API Services
Installation
- Clone the repository:bash
git clone https://github.com/hydroserver2/hydroserver-api-services.git cd hydroserver-api-services
- Install the dependencies:bash
pip install -r requirements.txt
- Create a .env file in the root of the repository 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 development web server:bash
python manage.py runserver
HydroServer Data Management App
Installation
- Clone the repository:bash
git clone https://github.com/hydroserver2/hydroserver-data-management-app.git
- Navigate to the project directory and install the required packages:bash
cd hydroserver-data-management-app npm install
- Create a .env file in the root of the repository 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 preview
bashnpm run dev