constructive-deployment

Deploy the Constructive platform locally and to production using Docker Compose, pgpm, and the Constructive CLI. Use when asked to "deploy constructive", "set up docker compose", "run constructive locally", "deploy to production", or when working with the constructive monorepo's Docker and infrastructure files.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "constructive-deployment" with this command: npx skills add constructive-io/constructive-skills/constructive-io-constructive-skills-constructive-deployment

Constructive Deployment

How to deploy the Constructive platform — local development with Docker Compose, database migrations with pgpm, and production container builds.

When to Apply

Use this skill when:

  • Setting up the Constructive monorepo for local development
  • Running Docker Compose services (Postgres, MinIO, API servers)
  • Building the Constructive Docker image
  • Deploying database migrations to local or remote Postgres
  • Understanding the Makefile targets and service architecture

Local Development Setup

Prerequisites

  • Docker and Docker Compose
  • Node.js 22+ with pnpm
  • pgpm CLI (available from the constructive monorepo)

Quick Start

# 1. Start Postgres and MinIO containers
make up
# OR: docker-compose up -d

# 2. Bootstrap database roles (ensure PG env vars are loaded — see pgpm skill, references/env.md)
pgpm admin-users bootstrap --yes

# 3. Deploy all database modules
pgpm deploy --createdb --workspace --all --yes

Stopping

# Stop and remove containers + volumes
make down
# OR: docker-compose down -v

Docker Compose Services

Core Services (docker-compose.yml)

ServiceContainerImagePortPurpose
postgrespostgresghcr.io/constructive-io/docker/postgres-plus:175432PostgreSQL database
miniominiominio/minio9000S3-compatible object storage

Postgres credentials: postgres / password (local dev only)

Application Services (docker-compose.jobs.yml)

ServiceContainerPortPurpose
constructive-admin-serverconstructive-admin-server3002Internal admin GraphQL API (header-based routing)
constructive-serverconstructive-server3000Public GraphQL API (domain-based routing)
send-email-linksend-email-linkEmail function (invite, password reset, verification)

Running Application Services

The application services require a built Docker image:

# Build the constructive image
docker-compose -f docker-compose.jobs.yml build

# Start all application services
docker-compose -f docker-compose.jobs.yml up -d

Postgres Images

ImageUse Case
ghcr.io/constructive-io/docker/postgres-plus:17Recommended — includes all extensions needed by constructive
pyramation/postgres:17Lightweight alternative with common extensions

PostgreSQL 17+ is required for security_invoker views. Older images will fail with "unrecognized parameter security_invoker" errors.

Database Deployment

Deploy to Local Database

Prerequisite: Ensure PostgreSQL is running and PG env vars are loaded. See pgpm skill (references/docker.md) and pgpm skill (references/env.md).

pgpm deploy --createdb --workspace --all --yes

Deploy to Remote Database

Point pgpm at a remote Postgres instance via environment variables:

export PGHOST=remote-host.example.com
export PGPORT=5432
export PGUSER=postgres
export PGPASSWORD=secure-password
export PGDATABASE=constructive

pgpm deploy --workspace --all --yes

Verify Deployment

pgpm verify

Revert (Rollback)

# Revert last change
pgpm revert --yes

# Revert to a tagged release
pgpm revert --to @v1.0.0 --yes

# Revert everything
pgpm revert --all --yes

Docker Image Build

The Constructive monorepo builds a multi-stage Docker image:

Build Stages

  1. build stage — Node.js 22, installs pnpm, runs pnpm install --frozen-lockfile and pnpm run build
  2. constructive stage — Runtime image with built artifacts, PostgreSQL client, and CLI shims

CLI Shims

The Docker image exposes three CLI commands:

CommandMaps To
constructivenode /app/packages/cli/dist/index.js
cncnode /app/packages/cli/dist/index.js
pgpmnode /app/pgpm/pgpm/dist/index.js

Building Locally

docker build -t constructive:dev .

Makefile Targets

TargetCommandPurpose
make updocker-compose up -dStart Postgres + MinIO
make downdocker-compose down -vStop and clean up
make sshdocker exec -it postgres /bin/bashShell into Postgres container
make rolespgpm admin-users bootstrap/addBootstrap database roles
make installdocker exec postgres /sql-bin/install.shRun install script in container

Environment Variables

Server Configuration

VariableDescriptionExample
API_IS_PUBLICtrue for public API, false for admin (header-based)true
API_EXPOSED_SCHEMASComma-separated schemas to expose via GraphQLmetaschema_public,services_public
API_ANON_ROLEPostgreSQL role for unauthenticated requestsanonymous
API_ROLE_NAMEPostgreSQL role for authenticated requestsauthenticated
API_ENABLE_SERVICESEnable services schema (admin only)true
API_META_SCHEMASMeta schemas for validation and routingmetaschema_public,services_public
SERVER_HOSTServer bind address0.0.0.0
SERVER_ORIGINCORS origin*
SERVER_TRUST_PROXYTrust reverse proxy headerstrue
SERVER_STRICT_AUTHEnforce strict authenticationfalse

Database Connection

VariableDescriptionDefault
PGHOSTPostgreSQL hostlocalhost
PGPORTPostgreSQL port5432
PGUSERPostgreSQL userpostgres
PGPASSWORDPostgreSQL passwordpassword
PGDATABASETarget database name

Admin vs Public API

The Constructive platform runs two API servers:

  • Admin server (API_IS_PUBLIC=false, port 3002) — uses header-based routing (X-Api-Name, X-Database-Id, X-Meta-Schema). Used internally by the Constructive admin UI.
  • Public server (API_IS_PUBLIC=true, port 3000) — uses domain-based routing. Serves external client applications.

Networking

All Docker Compose services share the constructive-net network, allowing inter-service communication by container name (e.g., postgres:5432 from within the constructive-server container).

Troubleshooting

IssueCauseFix
Port 5432 in useAnother Postgres instance runningStop it or change the port in docker-compose.yml
security_invoker errorPostgres version < 17Use postgres-plus:17 or pyramation/postgres:17 image
role "authenticated" does not existMissing bootstrapRun pgpm admin-users bootstrap --yes
Container not on networkNetwork mismatchCheck docker network ls for constructive-net
Build fails at pnpm installLockfile mismatchRun pnpm install locally first to update lockfile

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

constructive-graphql-codegen

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github-workflows-ollama

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github-workflows-pgpm

No summary provided by upstream source.

Repository SourceNeeds Review