This document describes how to set up a Rocky Linux environment for testing DenoKV PostgreSQL integration.
- Rocky Linux 8 or 9
- Internet connection
- Non-root user with sudo privileges
Run the setup script:
chmod +x setup-rocky-linux.sh
./setup-rocky-linux.sh- Updates system packages - Ensures all packages are up to date
- Installs development tools - Installs essential development packages
- Installs PostgreSQL development libraries - Required for PostgreSQL backend compilation
- Installs Docker and Docker Compose - For running PostgreSQL test container
- Installs Rust - Required for building the project
- Installs additional dependencies - OpenSSL and pkg-config for Rust compilation
- Clones the repository - Downloads the DenoKV source code
- Builds the project - Compiles all components
- Creates test script - Generates a script to run PostgreSQL integration tests
After setup, you can run the PostgreSQL integration tests:
./test-postgres-integration.shTo start the DenoKV server for remote access, you need to set up authentication:
Option A: Automatic Token Generation (Recommended) The server script will automatically generate a secure token if none is provided:
# Required: PostgreSQL connection URL
export DENO_KV_POSTGRES_URL="postgresql://user:password@host:port/database"
# Optional: Additional configuration
export DENO_KV_DATABASE_TYPE="postgres" # Default: postgres
export DENO_KV_NUM_WORKERS="4" # Default: 4Option B: Manual Token Generation Generate a token manually using the utility script:
./generate-access-token.shOption C: Set Your Own Token
# Required: Access token for authentication (minimum 12 characters)
export DENO_KV_ACCESS_TOKEN="your-secure-access-token-here"
# Required: PostgreSQL connection URL
export DENO_KV_POSTGRES_URL="postgresql://user:password@host:port/database"
# Optional: Additional configuration
export DENO_KV_DATABASE_TYPE="postgres" # Default: postgres
export DENO_KV_NUM_WORKERS="4" # Default: 4./start-denokv-server.shThe server will start on 0.0.0.0:4512 and be accessible remotely.
Important: Make sure port 4512 is open in your firewall:
# Check if port is open
sudo firewall-cmd --list-ports
# If not open, add it:
sudo firewall-cmd --permanent --add-port=4512/tcp
sudo firewall-cmd --reloadWhen connecting from a Deno application, use the access token in the Authorization header:
const kv = await Deno.openKv("http://your-server:4512", {
accessToken: "your-secure-access-token-here"
});Important Security Notes:
- The access token must be at least 12 characters long
- Use a strong, randomly generated token for production
- Keep the access token secure and don't commit it to version control
- The server validates tokens using constant-time comparison for security
- Log out and log back in - This ensures Docker group membership takes effect
- Verify Docker access - Run
docker psto confirm Docker is accessible - Run tests - Execute the test script to verify everything works
If you get permission denied errors with Docker:
sudo usermod -aG docker $USER
# Then log out and log back inIf Rust commands are not found:
source ~/.cargo/envMake sure the PostgreSQL container is running:
docker-compose -f docker-compose.test.yml psdenokv/- Main DenoKV projectpostgres/- PostgreSQL backend implementationdocker-compose.test.yml- PostgreSQL test container configurationtest-postgres.sh- Original test scripttest-postgres-integration.sh- Enhanced test script for Rocky Linux
The test script sets the following environment variable:
POSTGRES_URL=postgresql://postgres:password@localhost:5432/denokv_test
To stop and remove the PostgreSQL test container:
docker-compose -f docker-compose.test.yml down