Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# --- base image ---
FROM postgres:17-bookworm AS base

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& update-ca-certificates \
&& sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y \
&& apt-get update

# --- pgrx builder base image
FROM base AS pgrx_builder_base

ENV DEBIAN_FRONTEND=noninteractive
ENV PG_MAJOR=17

RUN apt-get -qy install curl gnupg apt-transport-https \
libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev \
libssl-dev libxml2-utils xsltproc ccache \
build-essential git pkg-config libssl-dev clang libclang-dev \
postgresql-server-dev-$PG_MAJOR postgresql-common \
postgresql-common-dev protobuf-compiler libprotobuf-dev \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# --- etcd_fdw image ---
FROM pgrx_builder_base AS etcd_fdw_builder

ENV CARGO_PGRX_VERSION=0.16.1
ENV PATH="/root/.cargo/bin:${PATH}"

RUN . $HOME/.cargo/env \
&& rustup component add clippy rustfmt rust-src \
&& cargo install --force --locked cargo-pgrx@"${CARGO_PGRX_VERSION}" \
&& cargo pgrx init --pg$PG_MAJOR $(which pg_config)
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "rust-dev",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"git": "latest"
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"rust-lang.rust-analyzer",
"serayuzgur.crates"
]
}
},
"mounts": [
"source=cargo-home,target=/usr/local/cargo,type=volume",
"source=cargo-registry,target=/usr/local/cargo/registry,type=volume",
"source=cargo-target,target=/workspace/target,type=volume"
]
}
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@

A foreign data wrapper around etcd for postgres

## Setup
## Development Setup

### Option 1: Using DevContainer

The easiest way to get started is using the provided DevContainer configuration:

1. **Prerequisites**
- [Docker Desktop](https://www.docker.com/products/docker-desktop/) or Docker Engine
- [VS Code](https://code.visualstudio.com/) with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

2. **Open in DevContainer**
- Open this project in VS Code
- Press `F1` and select "Dev Containers: Reopen in Container"
- Wait for the container to build (~4 minutes first time)

3. **Start Developing**
- All dependencies are pre-installed (Rust, cargo-pgrx, PostgreSQL 17, protobuf)
- Cargo cache volumes ensure fast rebuilds
- Run `cargo pgrx run` to build and test

### Option 2: Manual Setup

- Install pgrx on your machine `cargo install --locked cargo-pgrx --version 0.16.1`
- Setup pgrx `cargo pgrx init`
Expand Down
Loading