Reading the repo
Opening the box…
Reading the repo
Opening the box…
How to install on macOS
This repo shows ASP.NET Core 9 logging in action; it also serves as a learning, experimenting and teaching path for .NET, Azure Pipelines and other technologies & tools.
Saved setup from 8 h ago
Will it work on macOS?
Heads-upIt also needs PostgreSQL.
Then run bash setup.sh. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
Needs Git: xcode-select --install
git clone https://github.com/satrapu/aspnet-core-logging.git cd aspnet-core-logging
.NET SDK, Docker
brew install --cask dotnet-sdk brew install --cask docker # Docker Desktop
Needs: PostgreSQL
brew install --cask docker # Docker Desktop docker compose -f docker-compose.yml up -d
dotnet restore Todo.WebApi.sln dotnet build Todo.WebApi.sln
dotnet test Todo.WebApi.sln
In order to run this application locally, you need to setup some things first, like: run PostgreSQL and pgAdmin via Docker Compose, create a PostgreSQL database using EF Core database migrations, etc.
This ASP.NET Core web API uses PostgreSQL as persistent storage and pgAdmin as database manager, all running locally via Docker Compose.
These volumes are needed to store data outside the Docker containers running the PostgreSQL databases and their manager.
docker volume create --name=aspnet-core-logging-db-for-local-dev_data
docker volume create --name=aspnet-core-logging-db-for-integration-tests_data
docker volume create --name=aspnet-core-logging-db-for-acceptance-tests_data
docker volume create --name=pgadmin_data
docker volume create --name=seq_data
The .env file is used by Docker Compose to avoid storing sensitive data inside docker-compose.yml file.
Create a new file named .env inside the folder where you have checked-out this git repository and add the following lines:
# Environment variables used by the local dev DB compose service
DB_LOCAL_POSTGRES_USER=<DB_LOCAL_USERNAME>
DB_LOCAL_POSTGRES_PASSWORD=<DB_LOCAL_PASSWORD>
# Environment variables used by the integration tests DB compose service
DB_INTEGRATION_TESTS_POSTGRES_USER=<DB_INTEGRATION_TESTS_USERNAME>
DB_INTEGRATION_TESTS_POSTGRES_PASSWORD=<DB_INTEGRATION_TESTS_PASSWORD>
# Environment variables used by the acceptance tests DB compose service
DB_ACCEPTANCE_TESTS_POSTGRES_USER==<DB_ACCEPTANCE_TESTS_USERNAME>
DB_ACCEPTANCE_TESTS_POSTGRES_PASSWORD=<DB_ACCEPTANCE_TESTS_PASSWORD>
# Environment variables used by DB client compose service
PGADMIN_DEFAULT_EMAIL=<PGADMIN_EMAIL>
PGADMIN_DEFAULT_PASSWORD=<PGADMIN_PASSWORD>
Make sure you replace all of the above <DB_LOCAL_USERNAME>, <DB_LOCAL_PASSWORD>, ..., <PGADMIN_PASSWORD> tokens with the appropriate values.
All of the commands below must be run from the folder where you have checked-out this git repository.
This folder contains a docker-compose.yml file describing the aforementioned compose services.
# The -d flag instructs Docker Compose to run services in the background
docker compose up -d
docker compose stop
docker compose start
# The -f flag instructs Docker Compose to display and follow the log entries of the 'pgadmin' service
docker compose logs -f pgadmin
The command below will not delete the Docker volumes!
docker compose down
Once the services have been started using docker compose up command, pgAdmin UI is ready to be used.
Open your browser and navigate to http://localhost:8080.
In order to start using pgAdmin, you need to authenticate - use the PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD properties found in your .env file to login.
When asked about a PostgreSQL server to register, populate the fields found inside Connection tab as below:
aspnet-core-logging-dev - the compose service name and not the container name
(the Docker Compose networking page is a little bit misleading,
as it mentions container name, that's why the services found inside the docker-compose.yml file are named differently than their containers)5432 - the Docker internal port${DB_DEV_POSTGRES_USER} property from the local .env file${DB_DEV_POSTGRES_PASSWORD} property from the local .env fileSince storing sensitive data inside configuration file put under source control is not a very good idea, the following environment variables must be defined on your local development machine:
| Name | Value | Description | |-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------
…
No reports for macOS yet.
GitManual AI Agent reads the 3 key files and writes a step-by-step guide for macOS. Once written, it's saved for everyone.