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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
/src/data/

.DS_Store
.env
.env

.claude
/docs
129 changes: 122 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ rand = "0.9.2"
bytes = "1.11.0"
async-stream = "0.3.6"
uuid = { version = "1.20.0", features = ["v4"] }
tokio-util = "0.7.18"
tokio-util = { version = "0.7.18", features = ["compat"] }
tiberius = { version = "0.12", default-features = false, features = ["rustls", "chrono"] }
aws-config = "1.8.13"
aws-sdk-s3 = { version = "1.122.0", features = ["behavior-version-latest"] }
async-compression = { version = "0.4.37", features = ["tokio", "gzip"] }
Expand Down
10 changes: 10 additions & 0 deletions databases.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
"port": 3050,
"host": "db-firebird",
"generated_id": "16706124-ff7e-4c97-8c83-0adeff214681"
},
{
"name": "Test database 13 - MysSQL",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in database name: "MysSQL" → "MSSQL".

The database name contains a typo: "Test database 13 - MysSQL" should be "Test database 13 - MSSQL".

📝 Proposed fix
-      "name": "Test database 13 - MysSQL",
+      "name": "Test database 13 - MSSQL",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"name": "Test database 13 - MysSQL",
"name": "Test database 13 - MSSQL",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@databases.json` at line 106, Update the "name" value in the JSON entry that
currently reads "Test database 13 - MysSQL" to correct the typo to "Test
database 13 - MSSQL"; locate the JSON object with the "name" key containing that
exact string and replace "MysSQL" with "MSSQL".

"database": "myappdb",
"type": "mssql",
"username": "sa",
"password": "Portabase!Strong1",
"port": 1433,
"host": "db-mssql",
"generated_id": "16706125-ff7e-4c97-8c83-0adeff214682"
}
]
}
10 changes: 10 additions & 0 deletions databases.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,14 @@ port = 3050
host = "db-firebird"
generated_id = "16706124-ff7e-4c97-8c83-0adeff214681"

[[databases]]
name = "Test database 13 - MSSQL"
database = "myappdb"
type = "mssql"
username = "sa"
password = "Portabase!Strong1"
port = 1433
Comment on lines +107 to +109
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid committing a concrete SA password in tracked config.

Line 108 hardcodes a privileged credential. Please switch to a non-sensitive placeholder and source real values from environment-specific config that is not committed.

Suggested diff
 username = "sa"
-password = "Portabase!Strong1"
+password = "changeme" # override via env/local untracked config
 port = 1433
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
username = "sa"
password = "Portabase!Strong1"
port = 1433
username = "sa"
password = "changeme" # override via env/local untracked config
port = 1433
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@databases.toml` around lines 107 - 109, Replace the hardcoded privileged
credential in databases.toml — specifically the password value for the
"password" key (and optionally the "username" key) — with a non-sensitive
placeholder and stop committing real secrets; instead wire the real SA password
into your deployment via an environment-specific, untracked config or
environment variable (e.g., use an env var like DB_SA_PASSWORD or a secrets
manager at runtime) and update any code that reads databases.toml to prefer the
env/secret source over the checked-in "password" entry; also ensure the
committed placeholder makes it clear that secrets must be supplied externally
and rotate the exposed credential immediately.

host = "db-mssql"
generated_id = "16706125-ff7e-4c97-8c83-0adeff214682"


19 changes: 19 additions & 0 deletions docker-compose.databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,24 @@ services:
networks:
- portabase

db-mssql:
container_name: db-mssql
image: mcr.microsoft.com/azure-sql-edge:latest
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Portabase!Strong1"
volumes:
- mssql-data:/var/opt/mssql
networks:
- portabase
healthcheck:
test: ["CMD-SHELL", "cat /proc/net/tcp6 | grep -q '059901' || exit 1"]
interval: 10s
timeout: 5s
retries: 20

volumes:
postgres-data:
mariadb-data:
Expand All @@ -171,6 +189,7 @@ volumes:
valkey-data:
valkey-data-auth:
firebird-data:
mssql-data:

networks:
portabase:
Expand Down
23 changes: 22 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV DOTNET_ROOT=/usr/local/dotnet
RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
&& chmod +x /tmp/dotnet-install.sh \
&& /tmp/dotnet-install.sh --channel 8.0 --install-dir /usr/local/dotnet \
&& rm /tmp/dotnet-install.sh \
&& /usr/local/dotnet/dotnet tool install --global microsoft.sqlpackage

ENV PATH="$PATH:/usr/local/dotnet:/root/.dotnet/tools"

RUN ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') \
&& curl -sSL "https://github.com/microsoft/go-sqlcmd/releases/latest/download/sqlcmd-linux-${ARCH}.tar.bz2" \
| tar -xjf - -C /usr/local/bin sqlcmd \
&& chmod +x /usr/local/bin/sqlcmd

ARG TARGETARCH

# =========================
Expand Down Expand Up @@ -97,12 +111,18 @@ RUN apt-get update && apt-get install -y \
libreadline8 \
libncurses6 \
zlib1g \
curl \
mariadb-client \
sqlite3 \
redis-tools \
valkey \
&& rm -rf /var/lib/apt/lists/*

ENV DOTNET_ROOT=/usr/local/dotnet
RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
&& chmod +x /tmp/dotnet-install.sh \
&& /tmp/dotnet-install.sh --channel 8.0 --runtime dotnet --install-dir /usr/local/dotnet \
&& rm /tmp/dotnet-install.sh

Comment on lines +121 to 126
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Test that sqlpackage works in the production image

# Build the production image
echo "Building production image..."
docker build --target prod -t portabase-prod-test -f docker/Dockerfile .

# Test sqlpackage availability and execution
echo "Testing sqlpackage in production image..."
docker run --rm portabase-prod-test /bin/bash -c "
    which sqlpackage && \
    sqlpackage /version || echo 'ERROR: sqlpackage failed to execute'
"

Repository: Portabase/agent

Length of output: 241


🏁 Script executed:

cat -n docker/Dockerfile | sed -n '20,140p'

Repository: Portabase/agent

Length of output: 4336


🌐 Web query:

sqlpackage .NET runtime requirements system requirements

💡 Result:

SqlPackage (.NET) runtime and system requirements (as of the latest Microsoft Learn guidance): 1) OS requirements (the same minimum OS requirements apply to both the dotnet-tool install and the self-contained.zip) - Windows (x64): Windows 11; Windows 10 (1607+); Windows Server Core 2012 R2+; Windows Server 2012 R2+ [1] - macOS (x64): macOS 14 “Sonoma”+ [1] - Linux (x64): Debian 12+; Red Hat Enterprise Linux 8+; SUSE Linux Enterprise Server 15 SP6+; Ubuntu 22.04+ [1] 2).NET runtime requirement (depends on how you install SqlPackage) - dotnet tool install (recommended): Installing SqlPackage as a global dotnet tool “requires the.NET SDK to be installed on your machine.” Also, SqlPackage is available as a dotnet tool for.NET 8 and later versions. [1] - Self-contained.zip download: “No.NET install is required” for the self-contained zip. [1] - SqlPackage built on.NET 10: Microsoft states “SqlPackage runs on Windows, macOS, and Linux and is built using.NET 10.” [1] So, if you use the recommended dotnet-tool method, ensure you have the.NET SDK (and a compatible.NET 8+ environment). If you use the self-contained.zip, you don’t need a separate.NET installation; just meet the OS requirements above. [1]

Citations:


Resolve: sqlpackage requires .NET SDK but production image installs only runtime.

The base image installs sqlpackage as a .NET global tool (line 30: dotnet tool install --global microsoft.sqlpackage), which requires the .NET SDK to function. However, the production image installs only the .NET runtime (line 124: --runtime dotnet), not the SDK. While the tool binaries are copied to the production image (line 136), they will fail at runtime because the .NET SDK is not available.

The solution is either:

  • Install the .NET SDK in production (not just runtime), or
  • Use the self-contained SqlPackage .zip distribution which does not require an SDK or runtime to be installed separately.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/Dockerfile` around lines 121 - 126, The image currently installs only
the .NET runtime via the install script (ENV DOTNET_ROOT and
/tmp/dotnet-install.sh with "--runtime dotnet"), but the Dockerfile also
installs sqlpackage as a dotnet global tool (microsoft.sqlpackage) which
requires the .NET SDK; either change the install invocation to install the SDK
(replace "--runtime dotnet" with the appropriate SDK channel/flag so the SDK is
present) or stop installing sqlpackage as a dotnet global tool and instead
download and extract the self-contained SqlPackage .zip distribution into the
image and copy those binaries into the final stage (remove dotnet tool install
--global microsoft.sqlpackage and use the self-contained zip approach); ensure
DOTNET_ROOT usage and any subsequent COPY of sqlpackage binaries align with the
chosen approach.

WORKDIR /app

Expand All @@ -113,8 +133,9 @@ RUN chmod +x /entrypoint.sh

COPY --from=base /usr/lib/postgresql/ /usr/lib/postgresql/
COPY --from=base /usr/local/mongodb/bin/ /usr/local/mongodb/bin/
COPY --from=base /root/.dotnet/tools/ /root/.dotnet/tools/


ENV PATH="$PATH:/usr/local/dotnet:/root/.dotnet/tools"
ENV APP_ENV=production

CMD ["/entrypoint.sh"]
8 changes: 7 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ seed-firebird:
echo "SELECT RDB\$RELATION_NAME FROM RDB\$RELATIONS WHERE RDB\$SYSTEM_FLAG = 0 AND RDB\$VIEW_BLR IS NULL;" \
| docker exec -i db-firebird isql -user alice -password fake_password /var/lib/firebird/data/mirror.fdb

seed-mssql:
echo "Seeding MSSQL..."
docker exec -i rust-dev sqlcmd -S "db-mssql,1433" -U sa -P "$MSSQL_SA_PASSWORD" -N disable -i /app/scripts/mssql/seed.sql
echo "Done"

seed-all:
just seed-mongo
just seed-mysql
just seed-postgres
just seed-postgres-1gb
just seed-sqlite
just seed-mongo
just seed-firebird
just seed-firebird
just seed-mssql
Comment on lines 53 to +61
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the duplicate Mongo seed call in seed-all.

seed-all runs just seed-mongo twice, which can create duplicate-seed side effects and slows the pipeline with no benefit.

Suggested diff
 seed-all:
     just seed-mongo
     just seed-mysql
     just seed-postgres
     just seed-postgres-1gb
     just seed-sqlite
-    just seed-mongo
     just seed-firebird
     just seed-mssql
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
seed-all:
just seed-mongo
just seed-mysql
just seed-postgres
just seed-postgres-1gb
just seed-sqlite
just seed-mongo
just seed-firebird
\ No newline at end of file
just seed-firebird
just seed-mssql
seed-all:
just seed-mongo
just seed-mysql
just seed-postgres
just seed-postgres-1gb
just seed-sqlite
just seed-firebird
just seed-mssql
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@justfile` around lines 53 - 61, seed-all target contains a duplicate
invocation of seed-mongo; edit the seed-all recipe to remove the second "just
seed-mongo" entry so seed-mongo is only run once, leaving the other seed tasks
(seed-mysql, seed-postgres, seed-postgres-1gb, seed-sqlite, seed-firebird,
seed-mssql) unchanged; verify no other duplicated seed calls exist in the
recipe.

Loading
Loading