Skip to content

david-slatinek/ag53

Repository files navigation

Description

.NET PostgreSQL MinIO Docker

Project for managing actors and movies made with ASP.NET Core 8.0, PostgreSQL, and MinIO.

Prerequisites

How to run

  1. Open a terminal, navigate to the db directory, and run the following commands:

    echo "POSTGRES_USER=david" >> .env
    echo "POSTGRES_PASSWORD=david" >> .env
    echo "POSTGRES_DB=ag53-db" >> .env

    If you change these values, you also need to change the connection string for all services by updating the DefaultConnection in appsettings.json files.

    If you want to see the database, open a web browser, navigate to http://localhost:7000, and login with the credentials you set in step 1.

  2. Run the following command to start the database:

    docker-compose up
  3. Open another terminal, navigate to the image-storage directory, and run the following commands:

    echo "MINIO_ROOT_USER=<YOUR USERNAME>" >> .env
    echo "MINIO_ROOT_PASSWORD=<YOUR PASSWORD" >> .env
  4. Run the following command to start the image storage:

    docker-compose up
  5. Open a web browser, navigate to http://localhost:9000, and login with the credentials you set in step 3.

  6. Create a new access key and secret key.

  7. Open movies-service/appsettings.json and replace the values of MinIOAccessKey and MinIOSecretKey with the values you set in step 6.

  8. Open a terminal, navigate to the root directory, and run the following command:

    docker-compose up

How to use

Open a web browser and navigate to:

Migration

  1. Open the terminal, navigate to the db directory, and run the following commands:

    echo "POSTGRES_USER=david" >> .env
    echo "POSTGRES_PASSWORD=david" >> .env
    echo "POSTGRES_DB=ag53-db" >> .env

    If you change these values, you also need to change the connection string for all services by updating the DefaultConnection in appsettings.json files.

    If you want to see the database, open a web browser, navigate to http://localhost:7000, and login with the credentials you set in step 1.

  2. Run the following command to start the database:

    docker-compose up
  3. Open another terminal, navigate to the actors-service directory, and run the following command:

    ./migration.sh

    If you are on Windows, manually run the commands in that file.

  4. Open another terminal, navigate to the movies-service directory, and run the following command:

    ./migration.sh

    If you are on Windows, manually run the commands in that file.