Git Product home page Git Product logo

postgresqldockertemplate's Introduction

Usage instructions

Start and Stop Docker Compose

  • To start Docker Compose, use the start_db_container.bat script. This script checks whether the Docker container postgres_db is already running. If it's not, the script starts the Docker Compose services in detached mode. If the container is already running, it informs the user. This ensures that the PostgreSQL database service managed by Docker Compose is running before proceeding with further operations.

  • PgAdmin will be accessible at http://localhost:5050

  • To stop Docker Compose, use the stop_db_container.bat script. This script checks if the Docker container postgres_db is currently running. If the container is not running, it notifies the user. If it is running, the script proceeds to stop the Docker Compose services, ensuring that the PostgreSQL database service managed by Docker Compose is properly shut down before any further actions.

Configure PGAdmin - Official documentation

  • Set your PgAdmin default email and password in the docker-compose.yml file, under the services/pgadmin/environment section.

  • In the servers.json file, you can configure your PgAdmin server. For more information, see the official PgAdmin documentation on Import/Export Servers

Configure PostgreSQL - Official documentation

  • Set the default PostgreSQL database user, password, and name in the docker-compose.yml file, under the services/postgres_db/environment section.

  • The pgpass file is used to automate the process of password authentication. For more information, see the official documentation:The Password File

Optional: Load a schema.sql or any other script by adding the following line in the services/postgres_db/volumes section of docker-compose.yml: - [location of the schema.sql file]:/docker-entrypoint-initdb.d/schema.sql. For more details, see the PostgreSQL Docker image documentation

.NET Core

Connection string

Set the connection string in the appsettings.json file. The default connection string is:

"ConnectionStrings": {
	"DefaultConnection": "UserID=user;Password=password;Host=localhost;Port=5432;Database=name_db;"
  }

Database

  • Create migrations using the following command:

     dotnet ef migrations add Init [-s ..\BlazorSandbox\] 

    The -s parameter is optional and specifies the startup project. If the data context is in a different project than the startup project, use the -s parameter. This command must be executed in the project where the data context is located.



  • Create or migrate the database using the following commands:

     dotnet ef database update [-s ..\BlazorSandbox\]

    The -s parameter is optional and specifies the startup project. If the data context is in a different project than the startup project, use the -s parameter. This command must be executed in the project where the data context is located.

FAQ

Q: My PotgreSQL container is rebooting and nerver starts.

A: Ensure your postgres_db_data/ folder is empty or contains working PostgreSQL database files.

postgresqldockertemplate's People

Contributors

gandalf-le-dev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.