This guide provides setup instructions for running the GoodFood application with two different approaches: Docker (recommended for quick setup) and Manual (for developers who prefer local development).
This provides a complete Docker-based environment with PostgreSQL database in containers.
- Docker Desktop - Download here
- .NET 8.0 SDK - Download here
- Docker Compose (usually included with Docker Desktop)
setup-and-run.batchmod +x setup-and-run.sh
./setup-and-run.sh- Stops existing containers - Cleans up any previous running instances
- Starts PostgreSQL database - Runs PostgreSQL 16 in a Docker container
- Waits for database - Ensures the database is ready before proceeding
- Runs migrations - Applies Entity Framework migrations to create the database schema
- Starts the web application - Builds and runs the GoodFood web application
- Web Application: http://localhost:8090
- PostgreSQL Database: localhost:5432
- Database:
goodfood_db_pub - Username:
postgres - Password:
6859 - Environment:
Staging
- Database:
For developers who prefer to run PostgreSQL and the application locally without Docker.
- .NET 8.0 SDK - Download here
- PostgreSQL 12+ - Download here
- pgAdmin (optional) - Download here
You need to create the following database on your local PostgreSQL server:
| Database Name | Purpose | Username | Password |
|---|---|---|---|
goodfood_db_pub |
Main application database | postgres |
2385 |
setup-manual.batchmod +x setup-manual.sh
./setup-manual.sh-
Create the database:
-- Connect to PostgreSQL as superuser and run: CREATE DATABASE goodfood_db_pub WITH OWNER = postgres ENCODING = 'UTF8';
-
Or use the provided SQL script:
psql -h localhost -p 5432 -U postgres -f setup-database.sql
-
Install EF Core tools:
dotnet tool install --global dotnet-ef
-
Run database migrations:
dotnet ef database update --project src/GoodFood.Infrastructure --startup-project src/GoodFood.Web
-
Run the application:
cd src/GoodFood.Web dotnet run
- Web Application:
- https://localhost:7001 (HTTPS)
- http://localhost:5000 (HTTP)
- PostgreSQL Database: localhost:5432
- Database:
goodfood_db_pub - Username:
postgres - Password:
2385 - Environment:
Development
- Database:
The application uses different configurations based on the environment:
| Environment | Used For | Database Host | Database Password | Port |
|---|---|---|---|---|
| Development | Manual/Local setup | localhost |
2385 |
5000/7001 |
| Staging | Docker setup | db (container) |
6859 |
8090 |
| Production | Production deployment | localhost |
2385 |
varies |
GoodFood/
├── src/
│ ├── GoodFood.Web/ # Main web application
│ ├── GoodFood.Application/ # Application services
│ ├── GoodFood.Domain/ # Domain entities and logic
│ └── GoodFood.Infrastructure/ # Data access and external services
├── tests/ # Unit and integration tests
├── docker-compose.yml # Docker configuration
├── setup-and-run.bat/.sh # Docker setup scripts
├── setup-manual.bat/.sh # Manual setup scripts
└── setup-database.sql # Database creation script
# Create a new migration
dotnet ef migrations add MigrationName --project src/GoodFood.Infrastructure --startup-project src/GoodFood.Web
# Update database
dotnet ef database update --project src/GoodFood.Infrastructure --startup-project src/GoodFood.Web
# Remove last migration
dotnet ef migrations remove --project src/GoodFood.Infrastructure --startup-project src/GoodFood.Web# Start only database
docker-compose up -d db
# Start everything
docker-compose up --build
# Stop all services
docker-compose down
# Stop and remove all data
docker-compose down -v
# View logs
docker-compose logs webapp
docker-compose logs dbFor Docker Setup:
- Ensure Docker is running
- Check container status:
docker ps - Verify database health:
docker exec goodfood_db pg_isready -U postgres -d goodfood_db_pub
For Manual Setup:
- Ensure PostgreSQL service is running
- Verify database exists:
psql -h localhost -p 5432 -U postgres -l - Test connection:
psql -h localhost -p 5432 -U postgres -d goodfood_db_pub
- Ensure .NET 8.0 SDK is installed:
dotnet --version - Verify project builds:
dotnet build src/GoodFood.Web/GoodFood.Web.csproj - Check connection strings in appsettings files
Docker: Modify ports in docker-compose.yml
Manual: The application will use the next available port automatically
setup-database.sql- SQL script to create required databasesdocker-compose.override.yml- Development overrides for DockerDockerfile- Application container configuration