بنقرة واحدة
initialize-pgdb
Initialize a PostgreSQL database and user on any configured host
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Initialize a PostgreSQL database and user on any configured host
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Add an AeroSpace window rule to assign an app/window to a workspace (macOS only)
Create or update secrets using Infisical (preferred) or legacy agenix files
Re-encrypt all secrets after modifying .age files or changing host keys
Decrypt and view the contents of an .age secret file
Deploy NixOS/Darwin configuration to local or remote host using justfile commands
Analyze project from URL/path and auto-detect build system to create Nix package
| name | initialize-pgdb |
| description | Initialize a PostgreSQL database and user on any configured host |
| compatibility | Requires postgres MCP servers (pilaster, monolith, zenith) |
| metadata | {"author":"ruinous.ai","version":"1.0","domain":"database"} |
| parameters | {"hostname":{"type":"select","description":"PostgreSQL host to create the database on","required":true,"options":[{"label":"pilaster (Recommended)","description":"Main web services - PILASTER_POSTGRES_DATABASE_URI"},{"label":"monolith","description":"Infrastructure services - MONOLITH_POSTGRES_DATABASE_URI"},{"label":"zenith","description":"AI/GPU workloads - ZENITH_POSTGRES_DATABASE_URI"},{"label":"chassis","description":"AI development workstation - CHASSIS_POSTGRES_DATABASE_URI"},{"label":"tty-ruinous-social","description":"Cloud VPS - TTY_RUINOUS_SOCIAL_POSTGRES_DATABASE_URI"}]},"db_name":{"type":"string","description":"Database name (also used as username)","required":true,"placeholder":"myservice"}} |
Create a new PostgreSQL database and user with sane defaults on any configured host.
If parameters are missing from $ARGUMENTS, use mcp_question to gather them:
mcp_question({
questions: [
{
question: "Which PostgreSQL host should the database be created on?",
header: "Host",
options: [
{ label: "pilaster (Recommended)", description: "Main web services host" },
{ label: "monolith", description: "Infrastructure services" },
{ label: "zenith", description: "AI/GPU workloads" },
{ label: "chassis", description: "AI development workstation" },
{ label: "tty-ruinous-social", description: "Cloud VPS" }
]
},
{
question: "What should the database be named? (Also used as username)",
header: "DB Name",
options: [
{ label: "Enter name...", description: "e.g., myservice, n8n, wikijs" }
]
}
]
})
Expected $ARGUMENTS format: <hostname> <db_name>
pilaster myservicezenith openwebuiThe skill uses these environment variables from .envrc.local to connect:
| Host | Environment Variable |
|---|---|
| pilaster | PILASTER_POSTGRES_DATABASE_URI |
| monolith | MONOLITH_POSTGRES_DATABASE_URI |
| zenith | ZENITH_POSTGRES_DATABASE_URI |
| chassis | CHASSIS_POSTGRES_DATABASE_URI |
| tty-ruinous-social | TTY_RUINOUS_SOCIAL_POSTGRES_DATABASE_URI |
Based on hostname, select the appropriate MCP postgres tool:
pilaster → mcp_postgres-pilaster_querymonolith → mcp_postgres-monolith_queryzenith → mcp_postgres-zenith_querytty-ruinous-social → Not available via MCP (use SSH)openssl rand -base64 24 | tr -d '/+=' | head -c 20
Run each SQL statement separately using the appropriate MCP tool:
CREATE DATABASE <db_name>;
CREATE USER <db_name> WITH PASSWORD '<generated_password>';
GRANT ALL PRIVILEGES ON DATABASE <db_name> TO <db_name>;
Connect to the new database and grant schema permissions:
-- This requires connecting to the new database
-- For MCP tools, this may need to be done via the container
GRANT ALL ON SCHEMA public TO <db_name>;
Note: The MCP postgres tools connect to the postgres database. To grant schema permissions on the new database, you may need to:
\c <db_name> if the tool supports it, ORssh <hostname> "docker exec -i postgres psql -U postgres -d <db_name> -c 'GRANT ALL ON SCHEMA public TO <db_name>;'"Provide the connection string in multiple formats:
For Docker containers (internal network):
DATABASE_URL=postgresql://<db_name>:<password>@postgres:5432/<db_name>
For external access (via hostname):
DATABASE_URL=postgresql://<db_name>:<password>@<hostname>.meskill.farm:5432/<db_name>
servicenet and datanet networksdependsOn = ["postgres"]; to container definition/encrypt-secret| Host | Internal Hostname | Port | Notes |
|---|---|---|---|
| pilaster | postgres | 5432 | Main web services |
| monolith | postgres | 5432 | Infrastructure |
| zenith | postgres | 5432 | AI workloads |
| tty-ruinous-social | postgres | 5432 | Cloud VPS |
# Create database on pilaster
/initialize-pgdb pilaster rallly
# Create database on zenith for AI service
/initialize-pgdb zenith openwebui
# Create database on monolith
/initialize-pgdb monolith gatus
✅ Database created successfully!
Host: pilaster
Database: rallly
Username: rallly
Password: xK7mN2pQ9rT4vW6y
Connection Strings:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Docker (internal):
DATABASE_URL=postgresql://rallly:xK7mN2pQ9rT4vW6y@postgres:5432/rallly
External:
DATABASE_URL=postgresql://rallly:xK7mN2pQ9rT4vW6y@pilaster.meskill.farm:5432/rallly
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Next steps:
1. Add to container networks: ["servicenet", "datanet"]
2. Add dependency: dependsOn = ["postgres"];
3. Encrypt credentials: /encrypt-secret hosts/pilaster/files/docker/env/rallly.env.age
-- Check if database exists
SELECT datname FROM pg_database WHERE datname = '<db_name>';
-- Drop if needed (CAREFUL!)
DROP DATABASE <db_name>;
DROP USER <db_name>;
-- Check existing users
SELECT usename FROM pg_user WHERE usename = '<db_name>';
-- Update password instead
ALTER USER <db_name> WITH PASSWORD '<new_password>';
.envrc.local