-
Postgres download:
- Download PostgreSQL natively, OR
- Download Docker
-
.NET SDK: Ensure .NET SDK version 10.0 is installed on your system. Download .NET 10.0. You can verify you are using the correct version by running
dotnet --versionin the command line.
This application may be run from docker using the following docker command:
docker compose up
Built containers must always be rebuilt after code changes, including pulled code from GitHub, using the following:
docker compose up --build
PostgreSQL databse connection credentials are set in docker-compose.yaml and the default values are set to connect to the composed database automatically for rapid deployment.
- Environment variables:
- Either rename the file
.env_samplein the root directory to.env, or:- Create a new file named
.envin the root directory. - Copy the contents of
.env_sampleto.env.
- Create a new file named
- Either rename the file
Once you have a .env file, be sure to periodically check .env_sample for updates as they won't automatically apply to your .env.
-
PostgreSQL Setup:
- Native Install:
- Install and launch PostgreSQL.
- Create a PostgreSQL server.
- Postgres on Docker:
- Run the following command:
docker run --name DeepLynx -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=deeplynx -d -p 5432:5432 postgres
- Run the following command:
- Add appropriate credentials for the newly created PostgreSQL server to their respective variables in
.env. For example:POSTGRES_DB_HOST=localhostPOSTGRES_PASSWORD=your_password
- Native Install:
-
.NET SDK Setup:
- Install the .NET SDK version 9.0.
-
(Optional) Entity Framework CLI to create and run migrations manually:
- Install the .NET Entity Framework CLI tool globally:
dotnet tool install --global dotnet-ef
- Install the .NET Entity Framework CLI tool globally:
Migrations should be applied automatically on application startup either locally or within docker and fail gracefully. The most common reason for failure will be either a PostgreSQL database is not running or listening for incoming connections, or incorrect credentials to an intended PostgreSQL database.
-
Navigate to the root folder in your project directory.
-
Run the following command to apply the latest migrations and update the database:
dotnet ef database update -c DeeplynxContext --verbose --project deeplynx.datalayer --startup-project deeplynx.api
If the above command fails with a Could not exeucte or similar message, dotnet ef may need to be added to your PATH.
Please update your path to include the .NET tools directory, similar to: export PATH="$PATH:/Users/_username_/.dotnet/tools"
If you make changes to the datalayer, create a new database migration with a descriptive name. For example, to add a migration for updating the users table, run:
dotnet ef migrations add UpdateUsersExample -c DeeplynxContext --verbose --project deeplynx.datalayer --startup-project deeplynx.api
See CONTRIBUTING for more details.
- Ensure that your PostgreSQL server is running before attempting to launch the app, update the database, or create migrations.