code
The code template provides a ready-to-use AI coding sandbox, integrating Code-Server (Web VS Code), Jupyter Lab, JuiceFS distributed filesystem, and a feature-rich PostgreSQL database.
Overview
- Config Name:
code - Node Count: Single node
- Description: AI coding sandbox with Web IDE + Jupyter + JuiceFS + PostgreSQL
- OS Distro:
el8,el9,el10,d12,d13,u22,u24 - OS Arch:
x86_64,aarch64 - Related:
meta
Usage:
./configure -c code [-i <primary_ip>]
Content
Source: pigsty/conf/code.yml
---
#==============================================================#
# File : code.yml
# Desc : Pigsty ai vibe coding sandbox
# Ctime : 2026-01-19
# Mtime : 2026-01-22
# Docs : https://pigsty.io/docs/conf/vibe
# License : Apache-2.0 @ https://pigsty.io/docs/about/license/
# Copyright : 2018-2026 Ruohang Feng / Vonng ([email protected])
#==============================================================#
# VIBE CODING SANDBOX
# PostgreSQL with related extensions
# Coding Agent, Code-Server, Jupyter
#
# Usage:
# curl https://repo.pigsty.io/get | bash
# ./configure -c code
# ./deploy.yml
# ./juice.yml # pgfs: juicefs on pgsql
# ./code.yml # code-server
all:
children:
infra: { hosts: { 10.10.10.10: { infra_seq: 1 }} ,vars: { repo_enabled: false }}
etcd: { hosts: { 10.10.10.10: { etcd_seq: 1 }} ,vars: { etcd_cluster: etcd }}
pgsql: { hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary } } ,vars: { pg_cluster: pgsql }}
# optional modules
#minio: { hosts: { 10.10.10.10: { minio_seq: 1 }} ,vars: { minio_cluster: minio }}
#redis-ms:
# hosts: { 10.10.10.10: { redis_node: 1 , redis_instances: { 6379: { }, 6380: { replica_of: '10.10.10.10 6379' } } } }
# vars: { redis_cluster: redis-ms ,redis_password: 'redis.ms' ,redis_max_memory: 64MB }
vars:
#----------------------------------------------#
# INFRA: https://pigsty.io/docs/infra
#----------------------------------------------#
version: v4.0.0 # pigsty version string
admin_ip: 10.10.10.10 # admin node ip address
region: default # upstream mirror region: default,china,europe
infra_portal: # infra services exposed via portal
home : { domain: i.pigsty } # default domain name
dns_enabled: false # disable dns service
blackbox_enabled: false # disable blackbox exporter
alertmanager_enabled: false # disable alertmanager
vtrace_enabled: false # enable vtrace extension
infra_extra_services: # home page navigation entries
- { name: Code Server ,url: '/code' ,desc: 'VS Code Server' ,icon: 'code' }
#----------------------------------------------#
# NODE: https://pigsty.io/docs/node
#----------------------------------------------#
nodename_overwrite: false # do not overwrite node hostname on single node mode
node_tune: oltp # node tuning specs: oltp,olap,tiny,crit
node_dns_method: none # do not setup dns
node_repo_modules: node,infra,pgsql # add these repos directly to the singleton node
node_packages: [ openssh-server, juicefs, restic, rclone, uv, opencode, claude, code-server, golang, nodejs, asciinema, genai-toolbox, postgrest ]
docker_enabled: true # enable docker service
#docker_registry_mirrors: ["https://docker.1panel.live","https://docker.1ms.run","https://docker.xuanyuan.me","https://registry-1.docker.io"]
#----------------------------------------------#
# PGSQL: https://pigsty.io/docs/pgsql
#----------------------------------------------#
pg_version: 18 # Default PostgreSQL Major Version is 18
pg_conf: oltp.yml # pgsql tuning specs: {oltp,olap,tiny,crit}.yml
pg_packages: [ pgsql-main, patroni, pgbackrest, pg_exporter, pgbackrest_exporter ]
pg_extensions:
- postgis timescaledb pg_cron pgvector vchord pgvectorscale pg_search pg_textsearch vchord_bm25
- pg_duckdb pg_mooncake pg_clickhouse pg_parquet pg_tle pljs plprql pg_stat_monitor pg_wait_sampling
- pg_ddlx pglinter pg_permissions safeupdate pg_dirtyread
- pg_anon pgsmcrypto credcheck pg_vault pgsodium pg_session_jwt documentdb
- pgsql-feat pgsql-type pgsql-util pgsql-func pgsql-fdw
pg_users:
- { name: dbuser_meta ,password: DBUser.Meta ,pgbouncer: true ,roles: [dbrole_admin ] ,comment: pigsty admin user }
- { name: dbuser_view ,password: DBUser.Viewer ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer }
pg_databases:
- { name: meta, baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty] ,extensions: [ postgis, timescaledb, vector ]}
pg_libs: 'timescaledb, pg_stat_statements, auto_explain, pg_wait_sampling'
pg_hba_rules:
- { user: all ,db: all ,addr: intra ,auth: pwd ,title: 'everyone intranet access with password' ,order: 800 }
- { user: all ,db: all ,addr: world ,auth: pwd ,title: 'everyone world access with password' ,order: 900 }
pg_crontab: [ '00 01 * * * /pg/bin/pg-backup full' ] # make a full backup every 1am
patroni_mode: remove # remove patroni after deployment
pgbouncer_enabled: false # disable pgbouncer pool
pgbouncer_exporter_enabled: false # disable pgbouncer_exporter on pgsql hosts?
pgbackrest_exporter_enabled: false # disable pgbackrest_exporter
pg_default_services: [] # do not provision pg services
#pg_reload: false # do not reload patroni/service
#----------------------------------------------#
# JUICE : https://pigsty.io/docs/juice
#----------------------------------------------#
juice_instances: # dict of juicefs filesystems to deploy
jfs:
path : /fs
meta : postgres://dbuser_meta:[email protected]:5432/meta
data : --storage postgres --bucket 10.10.10.10:5432/meta --access-key dbuser_meta --secret-key DBUser.Meta
port : 9567
#----------------------------------------------#
# VIBE : https://pigsty.io/docs/pilot/code
#----------------------------------------------#
# CHANAGE PASSWORD!
code_enabled: true
code_password: Code.Server
jupyter_enabled: true
jupyter_password: Jupyter.Lab
node_pip_packages: jupyter
#----------------------------------------------#
# PASSWORD : https://pigsty.io/docs/setup/security/
#----------------------------------------------#
grafana_admin_password: pigsty
grafana_view_password: DBUser.Viewer
pg_admin_password: DBUser.DBA
pg_monitor_password: DBUser.Monitor
pg_replication_password: DBUser.Replicator
patroni_password: Patroni.API
haproxy_admin_password: pigsty
...
Explanation
The code template is an AI-era web coding sandbox, enabling development, data analysis, and AI application building directly in browser.
Core Components:
| Component | Description | Access |
|---|---|---|
| Code-Server | Web-based VS Code, full-featured editor | http://<ip>/code |
| Jupyter Lab | Interactive data science notebook | http://<ip>:8888 |
| JuiceFS | PostgreSQL-backed distributed filesystem | Mount at /fs |
| PostgreSQL 18 | Feature-rich database with vector/timeseries/FTS extensions | Port 5432 |
Pre-installed Tools:
- AI Assistants:
opencode,claudeCLI coding tools - Runtimes:
golang,nodejs,uv(Python package manager) - Data Tools:
postgrest(auto REST API),genai-toolbox - Utilities:
restic,rclone(backup/sync),asciinema(terminal recording)
PostgreSQL Extensions:
Pre-installed extensions covering AI/vector, timeseries, FTS, analytics:
# Vector & AI
pgvector, vchord, pgvectorscale, pg_search, vchord_bm25
# Timeseries & GIS
timescaledb, postgis, pg_cron
# Analytics & Lakehouse
pg_duckdb, pg_mooncake, pg_clickhouse, pg_parquet
# Security & Audit
pg_anon, pgsmcrypto, credcheck, pg_vault, pgsodium
# Development
pg_tle, pljs, plprql, documentdb
JuiceFS Filesystem
This template uses JuiceFS for distributed filesystem capability, with a unique feature: both metadata and data stored in PostgreSQL.
Architecture:
- Metadata Engine: PostgreSQL stores filesystem metadata
- Data Storage: PostgreSQL Large Objects store file data
- Mount Point: Default
/fsdirectory - Metrics Port:
9567for Prometheus scraping
Use Cases:
- Persistent storage for code projects
- Jupyter Notebook working directory
- AI model and dataset storage
- File sharing across instances (when scaling to multiple nodes)
Configuration:
juice_instances:
jfs:
path : /fs
meta : postgres://dbuser_meta:[email protected]:5432/meta
data : --storage postgres --bucket 10.10.10.10:5432/meta --access-key dbuser_meta --secret-key DBUser.Meta
port : 9567
Deployment
# 1. Download Pigsty
curl https://repo.pigsty.io/get | bash
# 2. Use code template
./configure -c code
# 3. Change passwords (important!)
vi pigsty.yml
# Modify code_password, jupyter_password, etc.
# 4. Deploy infra and PostgreSQL
./deploy.yml
# 5. Deploy JuiceFS filesystem
./juice.yml
# 6. Deploy Code-Server and Jupyter
./code.yml
Access
After deployment, access via browser:
# Code-Server (VS Code Web)
http://<ip>/code
# Password: Code.Server (change it!)
# Jupyter Lab
http://<ip>:8888
# Password: Jupyter.Lab (change it!)
# Grafana Monitoring
http://<ip>:3000
# Username: admin, Password: pigsty
# PostgreSQL
psql postgres://dbuser_meta:DBUser.Meta@<ip>:5432/meta
Use Cases
- AI App Development: Build RAG, Agent, LLM applications
- Data Science: Jupyter-based data analysis and visualization
- Remote Development: Cloud-based Web IDE environment
- Education: Consistent dev environment for students
- Rapid Prototyping: Quick idea validation without local setup
Notes
- Change Passwords: Default
code_passwordandjupyter_passwordare for testing only - Network Security: This template opens world access (
addr: world), configure firewall or VPN for production - Resources: Recommend 2+ cores, 4GB+ RAM, SSD storage
- Simplified Architecture: Patroni, PgBouncer disabled for single-node dev environment
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.