Skip to content

Commit f506144

Browse files
coodosxPathin
andauthored
Chore/evault pitstop refactor (#395)
* chore: move eVault chore architecture to multi-tenant * chore: add tests * feat: mark verification code as consumed after linking * test: verify verification record is marked as consumed * feat: add UUID validation for namespace in provisioning and made W3ID generation deterministic again. * chore: fix build * chore: attempt to fix CI fail on tests * fix: CI to rebuild native modules * fix: add rebuild command and remove docker buildx * chore: fix code review problems * chore: add workflow to run registry tests on CI * chore; pnpm lock * chore: remove commented out stale code * chore: run format * chore: fix more review comments, and add test to make sure eName is always deterministic * chore: fix pnpm lock --------- Co-authored-by: Patrick Fischer <[email protected]>
1 parent db678df commit f506144

File tree

106 files changed

+35497
-41750
lines changed

Some content is hidden

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

106 files changed

+35497
-41750
lines changed

.github/workflows/tests-evault-core.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,34 @@ jobs:
2323
with:
2424
node-version: 22
2525

26+
- name: Install build dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y build-essential python3
30+
2631
- name: Install pnpm
2732
run: npm install -g pnpm
2833

2934
- name: Install dependencies
3035
run: pnpm install
3136

37+
- name: Clean and rebuild ssh2 native module
38+
run: |
39+
# Remove any pre-built binaries that might be incompatible
40+
find node_modules -name "sshcrypto.node" -delete 2>/dev/null || true
41+
find node_modules -path "*/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node" -delete 2>/dev/null || true
42+
# Rebuild ssh2 specifically for this platform
43+
pnpm rebuild ssh2
44+
# Rebuild all other native modules
45+
pnpm rebuild
46+
3247
- name: Run tests
48+
env:
49+
CI: true
50+
GITHUB_ACTIONS: true
51+
DOCKER_HOST: unix:///var/run/docker.sock
52+
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
53+
TESTCONTAINERS_RYUK_DISABLED: false
54+
TESTCONTAINERS_HOST_OVERRIDE: localhost
3355
run: pnpm -F=evault-core test
3456

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tests [registry]
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'platforms/registry/**'
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- 'platforms/registry/**'
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Node.js 22
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
26+
- name: Install build dependencies
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y build-essential python3
30+
31+
- name: Install pnpm
32+
run: npm install -g pnpm
33+
34+
- name: Install dependencies
35+
run: pnpm install
36+
37+
- name: Clean and rebuild ssh2 native module
38+
run: |
39+
# Remove any pre-built binaries that might be incompatible
40+
find node_modules -name "sshcrypto.node" -delete 2>/dev/null || true
41+
find node_modules -path "*/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node" -delete 2>/dev/null || true
42+
# Rebuild ssh2 specifically for this platform
43+
pnpm rebuild ssh2
44+
# Rebuild all other native modules
45+
pnpm rebuild
46+
47+
- name: Run tests
48+
env:
49+
CI: true
50+
GITHUB_ACTIONS: true
51+
DOCKER_HOST: unix:///var/run/docker.sock
52+
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
53+
TESTCONTAINERS_RYUK_DISABLED: false
54+
TESTCONTAINERS_HOST_OVERRIDE: localhost
55+
run: pnpm -F=registry test
56+

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ yarn-error.log*
4040
# Misc
4141
.DS_Store
4242
*.pem
43-
4443

45-
evault-cache.json
44+
45+
evault-cache.json
46+
47+
.pnpm-store
48+
.pnpm-store/

Dockerfile.dev

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM node:20-alpine
2+
3+
WORKDIR /app
4+
5+
# Install pnpm
6+
RUN npm install -g [email protected]
7+
8+
# Copy entrypoint script
9+
COPY docker-entrypoint.sh /usr/local/bin/
10+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
11+
12+
ENTRYPOINT ["docker-entrypoint.sh"]
13+
14+
# Copy only root config files - source code comes via volumes
15+
# This keeps the image small and export fast
16+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
17+
18+
# Note: Dependencies are installed on first container run via entrypoint script
19+
# This avoids huge layer exports during build. Volumes mount source code,
20+
# and entrypoint ensures deps are installed before running commands.
21+

dev-docker-compose.README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Dev Docker Compose
2+
3+
This docker-compose file sets up the development environment for the Metastate project.
4+
5+
## Core Services (Always Running)
6+
7+
- **registry** - Runs on port 4321
8+
- **evault-core** - Runs on ports 3001 (Express/Provisioning) and 4000 (Fastify/GraphQL)
9+
- **neo4j** - Runs on ports 7474 (HTTP) and 7687 (Bolt) for graph data storage
10+
- **postgres** - Runs on port 5432 with multiple databases pre-created
11+
12+
## Optional Platform Services
13+
14+
Use Docker Compose profiles to enable optional platforms:
15+
16+
### Available Profiles
17+
18+
- `pictique` - Pictique API (port 1111)
19+
- `evoting` - eVoting API (port 4000)
20+
- `dreamsync` - DreamSync API (port 4001)
21+
- `cerberus` - Cerberus (port 3002)
22+
- `group-charter` - Group Charter Manager API (port 3003)
23+
- `blabsy` - Blabsy W3DS Auth API (port 3000)
24+
- `ereputation` - eReputation (port 5000)
25+
- `marketplace` - Marketplace (port 5001)
26+
- `all` - Enable all optional platforms at once
27+
28+
## Usage
29+
30+
### Start core services only:
31+
```bash
32+
docker compose -f dev-docker-compose.yaml up
33+
```
34+
35+
### Start with specific platforms:
36+
```bash
37+
# Single platform
38+
docker compose -f dev-docker-compose.yaml --profile pictique up
39+
40+
# Multiple platforms
41+
docker compose -f dev-docker-compose.yaml --profile pictique --profile evoting up
42+
43+
# All platforms
44+
docker compose -f dev-docker-compose.yaml --profile all up
45+
```
46+
47+
### Background mode:
48+
```bash
49+
docker compose -f dev-docker-compose.yaml --profile pictique up -d
50+
```
51+
52+
### Stop services:
53+
```bash
54+
docker compose -f dev-docker-compose.yaml down
55+
```
56+
57+
### View logs:
58+
```bash
59+
# All services
60+
docker compose -f dev-docker-compose.yaml logs -f
61+
62+
# Specific service
63+
docker compose -f dev-docker-compose.yaml logs -f registry
64+
```
65+
66+
## Environment Variables
67+
68+
Create a `.env` file in the project root with your configuration:
69+
70+
```env
71+
# Registry
72+
REGISTRY_SHARED_SECRET=your-secret-here
73+
PUBLIC_REGISTRY_URL=http://localhost:4321
74+
75+
# Database URLs (optional - defaults are provided)
76+
REGISTRY_DATABASE_URL=postgresql://postgres:postgres@postgres:5432/registry
77+
NEO4J_URI=bolt://neo4j:7687
78+
NEO4J_USER=neo4j
79+
NEO4J_PASSWORD=neo4j
80+
```
81+
82+
## Notes
83+
84+
- All services mount the source code for hot-reload development
85+
- Node modules are stored in Docker volumes to avoid host conflicts
86+
- PostgreSQL automatically creates all required databases on first startup
87+
- Services wait for database health checks before starting
88+
89+

0 commit comments

Comments
 (0)