postgres
This module is designed for development and CI purposes only, do not use it to host a production server.The module implements a server and a client that can work together.
You can use it to run a local postgreSQL database but also in your CI pipeline to test your application
with integrations tests.
Installation
dagger install github.com/quartz-technology/daggerverse/postgres@v0.0.3
Entrypoint
Return Type
Postgres !
Arguments
Name | Type | Description |
---|---|---|
user | Secret ! | User to access the database This value will be set as a secret variable in the container: `POSTGRES_USER` |
password | Secret ! | Password to access the database. This value will be set as a secret variable in the container: `POSTGRES_PASSWORD` |
dbPort | Integer ! | Port to expose the database on. |
dbName | String | Name of the database to create on start. If it's not set, the database's name will be the user's one. |
cache | Boolean | Enable data persistency by using a volume. |
version | String | PostgreSQL version to pull from the registry. |
configFile | File | Extra configuration file to add to the postgres database. This file will be copied in the container to `/usr/share/postgresql/postgresql.conf` |
initScript | Directory | Scripts to execute when the database is started. The files will be copied to `/docker-entrypoint-initdb.d` |
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Postgres {
return dag.
Postgres(user, password, dbPort)
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dag.Postgres:
return (
dag.postgres(user, password, db_port)
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Postgres {
return dag
.postgres(user, password, dbPort)
}
Types
Postgres 🔗
user() 🔗
Return Type
Secret !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer user
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Secret {
return dag.
Postgres(user, password, dbPort).
User()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.Secret:
return (
dag.postgres(user, password, db_port)
.user()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Secret {
return dag
.postgres(user, password, dbPort)
.user()
}
password() 🔗
Return Type
Secret !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer password
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Secret {
return dag.
Postgres(user, password, dbPort).
Password()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.Secret:
return (
dag.postgres(user, password, db_port)
.password()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Secret {
return dag
.postgres(user, password, dbPort)
.password()
}
name() 🔗
Return Type
String !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer name
func (m *myModule) example(ctx context.Context, user *Secret, password *Secret, dbPort int) string {
return dag.
Postgres(user, password, dbPort).
Name(ctx)
}
@function
async def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> str:
return await (
dag.postgres(user, password, db_port)
.name()
)
@func()
async example(user: Secret, password: Secret, dbPort: number, ): Promise<string> {
return dag
.postgres(user, password, dbPort)
.name()
}
port() 🔗
Return Type
Integer !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer port
func (m *myModule) example(ctx context.Context, user *Secret, password *Secret, dbPort int) int {
return dag.
Postgres(user, password, dbPort).
Port(ctx)
}
@function
async def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> int:
return await (
dag.postgres(user, password, db_port)
.port()
)
@func()
async example(user: Secret, password: Secret, dbPort: number, ): Promise<number> {
return dag
.postgres(user, password, dbPort)
.port()
}
version() 🔗
Return Type
String !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer version
func (m *myModule) example(ctx context.Context, user *Secret, password *Secret, dbPort int) string {
return dag.
Postgres(user, password, dbPort).
Version(ctx)
}
@function
async def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> str:
return await (
dag.postgres(user, password, db_port)
.version()
)
@func()
async example(user: Secret, password: Secret, dbPort: number, ): Promise<string> {
return dag
.postgres(user, password, dbPort)
.version()
}
configFile() 🔗
Return Type
File !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer config-file
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *File {
return dag.
Postgres(user, password, dbPort).
ConfigFile()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.File:
return (
dag.postgres(user, password, db_port)
.config_file()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): File {
return dag
.postgres(user, password, dbPort)
.configFile()
}
initScripts() 🔗
Return Type
Directory !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer init-scripts
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Directory {
return dag.
Postgres(user, password, dbPort).
InitScripts()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.Directory:
return (
dag.postgres(user, password, db_port)
.init_scripts()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Directory {
return dag
.postgres(user, password, dbPort)
.initScripts()
}
cache() 🔗
Return Type
Boolean !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer cache
func (m *myModule) example(ctx context.Context, user *Secret, password *Secret, dbPort int) bool {
return dag.
Postgres(user, password, dbPort).
Cache(ctx)
}
@function
async def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> bool:
return await (
dag.postgres(user, password, db_port)
.cache()
)
@func()
async example(user: Secret, password: Secret, dbPort: number, ): Promise<boolean> {
return dag
.postgres(user, password, dbPort)
.cache()
}
client() 🔗
Client returns a configured client with user and password set. Note: if you want to set the host, you can append this option on usage
Return Type
Container !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer client
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Container {
return dag.
Postgres(user, password, dbPort).
Client()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.Container:
return (
dag.postgres(user, password, db_port)
.client()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Container {
return dag
.postgres(user, password, dbPort)
.client()
}
database() 🔗
Database returns a ready to run Postgres container with all configuration applied.
Return Type
Container !
Example
dagger -m github.com/quartz-technology/daggerverse/postgres@627fc4df7de8ce3bd8710fa08ea2db6cf16712b3 call \
--user env:MYSECRET --password env:MYSECRET --db-port integer database
func (m *myModule) example(user *Secret, password *Secret, dbPort int) *Container {
return dag.
Postgres(user, password, dbPort).
Database()
}
@function
def example(user: dagger.Secret, password: dagger.Secret, db_port: int, ) -> dagger.Container:
return (
dag.postgres(user, password, db_port)
.database()
)
@func()
example(user: Secret, password: Secret, dbPort: number, ): Container {
return dag
.postgres(user, password, dbPort)
.database()
}