Skip to content

Commit b67b795

Browse files
committed
chore: plant the seeds for EdgeHog’s journey
0 parents  commit b67b795

File tree

131 files changed

+12972
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+12972
-0
lines changed

.changeset/config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{
6+
"repo": "kriasoft/edgehog"
7+
}
8+
],
9+
"commit": false,
10+
"fixed": [],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "main",
14+
"updateInternalDependencies": "patch",
15+
"ignore": [],
16+
"privatePackages": {
17+
"changesetIgnorePatterns": ["@edgehog/internal*"]
18+
}
19+
}

.changeset/initial-release.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@edgehog/db": patch
3+
---
4+
5+
Initial public release of @edgehog/db with PostgreSQL + TimescaleDB schema and migrations for market data.

.env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# PostgreSQL Database Configuration
2+
# Requirements: PostgreSQL 17 with TimescaleDB extension
3+
#
4+
# Installation:
5+
# https://docs.tigerdata.com/self-hosted/latest/install/
6+
# https://docs.tigerdata.com/self-hosted/latest/tooling/install-toolkit/
7+
#
8+
# Connection URL format: postgres://username:password@hostname:port/database
9+
DATABASE_URL=postgres://postgres@localhost:5432/edgehog
10+
11+
# Dedicated PostgreSQL database for EdgeHog automated tests (unit/integration).
12+
# This database may be reset during test runs (drop/truncate) — never point to production.
13+
TEST_DATABASE_URL=postgres://postgres@localhost:5432/edgehog_test

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#file:../CLAUDE.md #file:../CLAUDE.local.md
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Lightweight TimescaleDB image with toolkit support for CI/CD
2+
# Optimized for testing, not production HA workloads
3+
#
4+
# Usage:
5+
# Local build:
6+
# docker build -f .github/docker/Dockerfile.timescaledb -t edgehog-postgres:latest .
7+
#
8+
# For GitHub Actions: Pre-build and push to registry, then reference in workflow
9+
# For local development: Build locally and use with docker-compose
10+
#
11+
# Size comparison:
12+
# - timescale/timescaledb-docker (Alpine, no toolkit): ~300MB
13+
# - timescale/timescaledb-docker-ha (Ubuntu, full HA): ~2GB
14+
# - This image (Ubuntu, toolkit only): ~800MB
15+
16+
ARG PG_VERSION=17
17+
ARG TIMESCALEDB_VERSION=latest-pg17
18+
19+
# Use the HA image as base (already has toolkit compiled)
20+
# but strip unnecessary HA components after
21+
FROM timescale/timescaledb-ha:${TIMESCALEDB_VERSION}
22+
23+
ARG PG_VERSION
24+
25+
LABEL maintainer="EdgeHog"
26+
LABEL description="Lightweight TimescaleDB with toolkit for CI/CD testing"
27+
28+
# Remove HA-specific tools that we don't need for testing
29+
# This reduces image size from ~2GB to ~800MB
30+
RUN apt-get remove -y \
31+
patroni \
32+
pgbackrest \
33+
pgbackrest-exporter \
34+
pgbouncer-exporter \
35+
barman \
36+
&& apt-get autoremove -y \
37+
&& apt-get clean \
38+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
39+
40+
# Ensure TimescaleDB and toolkit are loaded
41+
RUN sed -i "s/shared_preload_libraries.*/shared_preload_libraries = 'timescaledb,timescaledb_toolkit'/" \
42+
/usr/local/share/postgresql/postgresql.conf.sample
43+
44+
EXPOSE 5432
45+
46+
ENTRYPOINT ["/docker-entrypoint.sh"]
47+
CMD ["postgres"]

.github/docker/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# EdgeHog TimescaleDB Docker Images
2+
3+
Lightweight, optimized Docker images for EdgeHog's CI/CD pipeline.
4+
5+
## What's Included
6+
7+
- **PostgreSQL 17** (default, fully supported)
8+
- **TimescaleDB** with pre-compiled **Toolkit**
9+
- **All extensions**: PostGIS, pgvector, h3, cron, and 20+ others
10+
- **Optimized size**: ~800MB (60% smaller than official HA)
11+
12+
## Quick Start
13+
14+
**Build locally:**
15+
16+
```bash
17+
docker build -f .github/docker/Dockerfile.timescaledb -t edgehog-postgres .
18+
```
19+
20+
**Use in docker-compose:**
21+
22+
```yaml
23+
services:
24+
postgres:
25+
image: edgehog-postgres
26+
environment:
27+
POSTGRES_DB: edgehog_test
28+
POSTGRES_HOST_AUTH_METHOD: trust
29+
ports:
30+
- 5432:5432
31+
```
32+
33+
**Use in GitHub Actions:**
34+
35+
```yaml
36+
services:
37+
postgres:
38+
image: timescale/timescaledb-ha:latest-pg17
39+
# OR use custom pre-built image: ghcr.io/username/edgehog-postgres:latest
40+
```
41+
42+
### Image Comparison
43+
44+
| Feature | timescaledb | timescaledb-ha | edgehog-postgres | Notes |
45+
| ------------- | ----------- | -------------- | ---------------- | ------------------------------ |
46+
| Base OS | Alpine | Ubuntu | Ubuntu | Based on official HA |
47+
| Actual Size | ~1.1GB | ~2GB | **~800MB** | ✅ Smallest production-ready |
48+
| PostgreSQL 17 |||| All support PG17 |
49+
| TimescaleDB |||| Pre-compiled |
50+
| Toolkit | ✗ Manual || **** | ✅ Pre-compiled |
51+
| Extensions | Most | All | **All** | ✅ PostGIS, pgvector, h3, etc. |
52+
| Patroni (HA) |||| Removed for smaller size |
53+
| pgBackRest |||| Removed for smaller size |
54+
| Purpose | Minimal | Prod HA | **CI/CD** | ✅ Sweet spot |
55+
56+
**Note:** Alpine advertises ~300MB but extracts to ~1.1GB. EdgeHog's approach is more efficient (800MB) because it keeps all extensions + toolkit while removing only unnecessary HA tools.

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
environment: release
16+
permissions:
17+
contents: write # to commit changelogs / version bumps
18+
pull-requests: write # to open or update the Version PR
19+
id-token: write # for npm provenance (recommended)
20+
21+
steps:
22+
- uses: actions/checkout@v5
23+
with: { fetch-depth: 0 } # changesets needs tags/history to compute versions
24+
25+
- uses: actions/setup-node@v6
26+
with: { node-version: "lts/*" }
27+
28+
- uses: oven-sh/setup-bun@v2
29+
with: { bun-version: "latest" }
30+
31+
- run: bun install --frozen-lockfile
32+
- run: bun run build
33+
34+
- run: |
35+
npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
36+
echo "NPM_CONFIG_PROVENANCE=true" >> $GITHUB_ENV
37+
git config user.name "github-actions[bot]"
38+
git config user.email "github-actions[bot]@users.noreply.github.com"
39+
env:
40+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
42+
- name: Import GPG key
43+
run: |
44+
mkdir -p ~/.gnupg
45+
chmod 700 ~/.gnupg
46+
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 -d | gpg --batch --pinentry-mode loopback --import
47+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
48+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
49+
cat <<'EOF' > ~/.gnupg/gpg-loopback-wrapper.sh
50+
#!/usr/bin/env bash
51+
exec gpg --batch --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" "$@"
52+
EOF
53+
chmod 700 ~/.gnupg/gpg-loopback-wrapper.sh
54+
git config user.signingkey ${{ secrets.GPG_KEY_ID }}
55+
git config commit.gpgsign true
56+
git config tag.gpgsign true
57+
git config gpg.program ~/.gnupg/gpg-loopback-wrapper.sh
58+
gpg-connect-agent reloadagent /bye || true
59+
env:
60+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
61+
62+
- uses: changesets/action@v1
63+
with:
64+
publish: bun changeset publish
65+
version: bun changeset version
66+
commit: "chore: version and release packages"
67+
title: "chore: version and release packages"
68+
setupGitUser: false
69+
createGithubReleases: true
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
72+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
73+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)