Welcome to the Zybach Platform! This guide provides comprehensive instructions for setting up and building the project locally.
Ensure the following software is installed:
-
Visual Studio 2022
-
Visual Studio Code
-
VS Code Extensions:
- Angular CLI from Balram Chavan
- Docker
- npm support for VS Code from egamma
- npm commands for VS Code from Florian Knop
- npm Intellisense from Christian Kohler
-
Node.js (Ensure Node.js 18 is used via NVM if needed)
-
Docker
-
Microsoft SQL Server
-
.NET 8 SDK
-
Clone the repository:
Clone the repository toC:/git/sitkatech
on your development machine. -
Set up a SQL user:
Create a SQL user (e.g.,DockerWebUser
) with thesysadmin
role and the passwordpassword#1
. Ensure that password policies are not enforced. -
Configuration files:
Copy the template files and remove .template from their file name to produce the following environment variable files. Reach out if you need help filling these out, as they are secrets and should not be committed to the repository..env
(from thedocker-compose
directory)appsecrets.json
(from theZybach.API
directory)secrets
(from theBuild
directory)- Create a file named geoserver-environment.properties with the following contents:
datastore-host = host.docker.internal datastore-password = password#1 datastore-user = DockerWebUser datastore-database = ZybachDB
-
Update environment configuration:
Copy[repo root dir]\docker-compose\.env.template
to[repo root dir]\docker-compose\.env
and update the values. -
Open the solution in Visual Studio 2022:
Setdocker-compose
as the startup project. Press the green play button to start the API server.
-
Open the web workspace:
Open theqanat-web-workspace
in Visual Studio Code ([repo root dir]\Zybach.Web
). -
Install dependencies and start the server:
In the VS Code terminal (or your favorite command line tool), run the following commands:npm install
npm build
npm start
-
Debugging:
PressF5
to launch the web app in Google Chrome and debug JavaScript in Visual Studio Code.- You may need to set up a launch configuration to point to
https://qanat.localhost.sitkatech.com
.
- You may need to set up a launch configuration to point to
-
Generate models:
Runnpm run gen-model
to generate models. If there’s an issue, use the following commands to resolve it:npm install @openapitools/openapi-generator-cli -g
openapi-generator-cli version-manager set 5.3.0
Local certificates should be generated automatically:
-
API:
- The
Zybach.API.csproj
file includes a post-build step during debugging that executesdotnet dev-certs https
.
- The
-
Web:
- The
package.json
file has aprestart
script that checks for local development certificates and attempts to create them if they don't exist.
- The
The automated tests can be run locally after creating an environment.json
file within the Zybach.Tests
project with the correct values. These tests are run on our CI builds and should be fixed as soon as possible to avoid bugs piling up.
If the project doesn't work after not working on it for a while, try the following:
-
Run
npm install
:
There might be updated or missing packages added by other developers. -
Download, Restore and Build the Database: Ensure your database matches the scaffolded entities by rebuilding your database.
-
Update Environment Variables:
Get the latest.env
,appsecrets.json
,build.ini
files from a colleague as there may be environment variables added since the last time you ran the project. -
Reach out to a colleague:
If you’re stuck, ask another developer who has recently worked on the project for help.
- In the
Zybach.Web\src\environments
folder, update the values in the following TypeScript files to point to your instances's resources:environment.ts
environment.qa.ts
environment.prod.ts
- In
auth.config.ts
, update themsalconfig
section to reflect your instance's configuration details.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
You may obtain a copy of the License at:
https://www.gnu.org/licenses/agpl-3.0
By using this project, you agree to the terms and conditions of this license, which ensure that any derivative works based on this project must also be open-source and made available to the public under the same terms.
Copyright California Water Data Consortium, Environmental Defense Fund, and Environmental Science Associates. Source code licensed under the AGPL 3.0.