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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.dylib
*.test
*.out
__debug_*

# Go build output
/bin/
Expand Down
68 changes: 34 additions & 34 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,47 @@ services:
redis:
image: 'redis:7-alpine'
ports:
- '6379:6379'
- '6374:6379'
redis-insight:
image: redis/redisinsight:latest
ports:
- "5540:5540"
environment:
- RI_REDIS_HOST=redis
- RI_REDIS_PORT=6379
- RI_REDIS_PORT=6374
- RI_REDIS_ALIAS=local-redis
gitlab:
image: "gitlab/gitlab-ce:latest"
container_name: gitlab
ports:
- "80:80"
- "443:443"
- "2222:22"
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://gitlab'
gitlab_rails['initial_root_password'] = 'password'
gitlab_rails['allow_local_requests_from_web_hooks_and_services'] = true
gitlab_rails['allow_local_requests_from_system_hooks'] = true
volumes:
- "./gitlab/config/gitlab:/etc/gitlab"
- "./gitlab/logs/gitlab:/var/log/gitlab"
- "./gitlab/data/gitlab:/var/opt/gitlab"
extra_hosts:
- host.docker.internal:host-gateway
networks:
- ci
gitlab-runner:
image: gitlab/gitlab-runner:latest
depends_on:
- gitlab
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./gitlab-runner/config:/etc/gitlab-runner"
extra_hosts:
- host.docker.internal:host-gateway
networks:
- ci
# gitlab:
# image: "gitlab/gitlab-ce:latest"
# container_name: gitlab
# ports:
# - "80:80"
# - "443:443"
# - "2222:22"
# environment:
# GITLAB_OMNIBUS_CONFIG: |
# external_url 'http://gitlab'
# gitlab_rails['initial_root_password'] = 'password'
# gitlab_rails['allow_local_requests_from_web_hooks_and_services'] = true
# gitlab_rails['allow_local_requests_from_system_hooks'] = true
# volumes:
# - "./gitlab/config/gitlab:/etc/gitlab"
# - "./gitlab/logs/gitlab:/var/log/gitlab"
# - "./gitlab/data/gitlab:/var/opt/gitlab"
# extra_hosts:
# - host.docker.internal:host-gateway
# networks:
# - ci
# gitlab-runner:
# image: gitlab/gitlab-runner:latest
# depends_on:
# - gitlab
# volumes:
# - "/var/run/docker.sock:/var/run/docker.sock"
# - "./gitlab-runner/config:/etc/gitlab-runner"
# extra_hosts:
# - host.docker.internal:host-gateway
# networks:
# - ci
smtp4dev:
image: rnwood/smtp4dev:latest
container_name: skemr-smtp4dev
Expand Down
15 changes: 14 additions & 1 deletion go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdB
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 h1:g0EZJwz7xkXQiZAI5xi9f3WWFYBlX1CPTrR+NDToRkQ=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/ClickHouse/ch-go v0.71.0 h1:bUdZ/EZj/LcVHsMqaRUP2holqygrPWQKeMjc6nZoyRM=
github.com/ClickHouse/ch-go v0.71.0/go.mod h1:NwbNc+7jaqfY58dmdDUbG4Jl22vThgx1cYjBw0vtgXw=
github.com/ClickHouse/clickhouse-go/v2 v2.43.0 h1:fUR05TrF1GyvLDa/mAQjkx7KbgwdLRffs2n9O3WobtE=
Expand Down Expand Up @@ -93,6 +101,8 @@ github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
Expand All @@ -112,6 +122,8 @@ github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7X
github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY=
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mfridman/xflag v0.1.0 h1:TWZrZwG1QklFX5S4j1vxfF1sZbZeZSGofMwPMLAF29M=
github.com/mfridman/xflag v0.1.0/go.mod h1:/483ywM5ZO5SuMVjrIGquYNE5CzLrj5Ux/LxWWnjRaE=
github.com/microsoft/go-mssqldb v1.9.6 h1:1MNQg5UiSsokiPz3++K2KPx4moKrwIqly1wv+RyCKTw=
Expand All @@ -131,6 +143,8 @@ github.com/paulmach/orb v0.12.0 h1:z+zOwjmG3MyEEqzv92UN49Lg1JFYx0L9GpGKNVDKk1s=
github.com/paulmach/orb v0.12.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU=
github.com/pierrec/lz4/v4 v4.1.25 h1:kocOqRffaIbU5djlIBr7Wh+cx82C0vtFb0fOurZHqD0=
github.com/pierrec/lz4/v4 v4.1.25/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
Expand Down Expand Up @@ -215,7 +229,6 @@ golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGN
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
Expand Down
9 changes: 9 additions & 0 deletions http/ai.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888

### List database changes
POST {{apiBaseUrl}}/projects/{{projectId}}/ai/complete
Authorization: Bearer {{jwt}}
9 changes: 9 additions & 0 deletions http/database-changes.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888

### List database changes
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/changes
Authorization: Bearer {{jwt}}
23 changes: 23 additions & 0 deletions http/database-entities.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-4aaa-8aaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888
@databaseEntityId = 22223333-4444-4aaa-8bbb-777788889999
@parentEntityId = 33334444-5555-4aaa-8bbb-888899990000

### List all entities discovered in a database
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/entities
Authorization: Bearer {{jwt}}

### List table entities
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/entities?type=table
Authorization: Bearer {{jwt}}

### List entities below a parent entity
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/entities?parentId={{parentEntityId}}
Authorization: Bearer {{jwt}}

### Get an entity
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/entities/{{databaseEntityId}}
Authorization: Bearer {{jwt}}
49 changes: 49 additions & 0 deletions http/databases.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888

### List databases in a project
GET {{apiBaseUrl}}/projects/{{projectId}}/databases
Authorization: Bearer {{jwt}}

### Create a PostgreSQL database connection
# @name createDatabase
POST {{apiBaseUrl}}/projects/{{projectId}}/databases
Authorization: Bearer {{jwt}}
Content-Type: application/json

{
"displayName": "Test Database",
"dbName": "test_db",
"username": "test_user",
"password": "test_pass",
"host": "localhost",
"port": 5433,
"sslMode": "disable",
"databaseType": "postgres"
}

### Get a database
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}
Authorization: Bearer {{jwt}}

### Update a database connection
PATCH {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}
Authorization: Bearer {{jwt}}
Content-Type: application/json

{
"displayName": "Test Database",
"dbName": "test_db",
"username": "test_user",
"password": "test_pass",
"host": "localhost",
"port": 5433,
"sslMode": "disable"
}

### Queue a manual database schema sync
POST {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/sync
Authorization: Bearer {{jwt}}
4 changes: 4 additions & 0 deletions http/health.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Health check
@host = http://localhost:8080

GET {{host}}/health
20 changes: 20 additions & 0 deletions http/integrations.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888
@projectAccessToken = replace-with-project-access-token

### List CI/CD rules using a project access token
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/integrations/ci-cd/rules
Authorization: Bearer {{projectAccessToken}}

### Report a completed CI/CD pipeline run
POST {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/integrations/ci-cd/pipeline-runs
Authorization: Bearer {{projectAccessToken}}
Content-Type: application/json

{
"environment": "production",
"status": "completed",
"completedAt": "2026-06-23T12:00:00Z"
}
14 changes: 14 additions & 0 deletions http/pipeline-runs.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888
@pipelineRunId = 55556666-7777-4aaa-8bbb-000011112222

### List pipeline runs
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/pipeline-runs
Authorization: Bearer {{jwt}}

### Get a pipeline run
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/pipeline-runs/{{pipelineRunId}}
Authorization: Bearer {{jwt}}
22 changes: 22 additions & 0 deletions http/projects.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc

### List projects
GET {{apiBaseUrl}}/projects
Authorization: Bearer {{jwt}}

### Create a project
# @name createProject
POST {{apiBaseUrl}}/projects
Authorization: Bearer {{jwt}}
Content-Type: application/json

{
"name": "Example project"
}

### Get a project
GET {{apiBaseUrl}}/projects/{{projectId}}
Authorization: Bearer {{jwt}}
32 changes: 32 additions & 0 deletions http/rules.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@databaseId = 11112222-3333-4444-5555-666677778888
@databaseEntityId = 22223333-4444-4aaa-8bbb-777788889999
@ruleId = 33334444-5555-4aaa-8bbb-888899990000

### Create an advisory rule for a database entity
# @name createRule
POST {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/rules
Authorization: Bearer {{jwt}}
Content-Type: application/json

{
"name": "Review users table changes",
"ruleType": "advisory",
"databaseEntityId": "{{databaseEntityId}}",
"attributes": {}
}

### List rules for a database
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/rules
Authorization: Bearer {{jwt}}

### Get a rule
GET {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/rules/{{ruleId}}
Authorization: Bearer {{jwt}}

### Delete a rule
DELETE {{apiBaseUrl}}/projects/{{projectId}}/databases/{{databaseId}}/rules/{{ruleId}}
Authorization: Bearer {{jwt}}
30 changes: 30 additions & 0 deletions http/secrets.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@jwt = replace-with-jwt
@projectId = aaaabbbb-aaaa-aaaa-aaaa-aaaabbbbcccc
@secretId = 44445555-6666-4aaa-8bbb-999900001111

### List project access tokens
GET {{apiBaseUrl}}/projects/{{projectId}}/secrets
Authorization: Bearer {{jwt}}

### Create a project access token
# The token is returned once. Store it in your private HTTP environment as projectAccessToken.
# @name createSecret
POST {{apiBaseUrl}}/projects/{{projectId}}/secrets
Authorization: Bearer {{jwt}}
Content-Type: application/json

{
"name": "CI token",
"expiresAt": "2026-12-31T23:59:59Z"
}

### Get a project access token
# This route is currently exposed by the API but returns "Not implemented".
GET {{apiBaseUrl}}/projects/{{projectId}}/secrets/{{secretId}}
Authorization: Bearer {{jwt}}

### Delete a project access token
DELETE {{apiBaseUrl}}/projects/{{projectId}}/secrets/{{secretId}}
Authorization: Bearer {{jwt}}
34 changes: 34 additions & 0 deletions http/webhooks.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@host = http://localhost:8080
@apiBaseUrl = {{host}}/api/v1
@gitlabWebhookToken = replace-with-gitlab-webhook-token

### Send a GitLab merge-request webhook
# GitLab sets the X-Gitlab-* headers and request body automatically in production.
POST {{apiBaseUrl}}/webhooks/gitlab
Content-Type: application/json
X-Gitlab-Token: {{gitlabWebhookToken}}
X-Gitlab-Event: Merge Request Hook

{
"object_kind": "merge_request",
"event_type": "merge_request",
"user": {
"name": "Example User",
"username": "example"
},
"project": {
"id": 1,
"name": "example-project",
"path_with_namespace": "group/example-project",
"web_url": "https://gitlab.example.com/group/example-project"
},
"object_attributes": {
"id": 1,
"iid": 1,
"title": "Example merge request",
"state": "opened",
"source_branch": "feature/example",
"target_branch": "main"
}
}

Binary file added skemr-api/cmd/server/__debug_bin92027419
Binary file not shown.
Loading
Loading