# JFrog Artifactory OSS + PostgreSQL

> Open source artifact repository manager.

- Category: DevOps & CI/CD
- Difficulty: intermediate
- Components: artifactory, postgresql, nginx
- Tags: artifactory, jfrog, repository, artifacts, binary-management
- Source: https://docker.recipes/devops/artifactory-oss

## Overview

JFrog Artifactory OSS is an open-source universal artifact repository manager that serves as a central hub for storing, organizing, and distributing binary artifacts throughout the software development lifecycle. Originally launched by JFrog in 2008, Artifactory has become the industry standard for artifact management, supporting over 30 package types including Maven, Gradle, npm, Docker, NuGet, and PyPI. The OSS version provides essential repository management capabilities for teams looking to centralize their binary artifact storage without the advanced features of the Pro and Enterprise versions. This stack combines Artifactory OSS with PostgreSQL as a robust, ACID-compliant database backend and NGINX as a high-performance reverse proxy. PostgreSQL replaces the default Derby database to provide better performance, scalability, and data integrity for production environments, while NGINX handles SSL termination, load balancing, and serves as a buffer against connection spikes. This architecture creates a production-ready artifact management platform that can handle substantial traffic loads and provides the reliability needed for continuous integration and deployment pipelines. This configuration is ideal for development teams, DevOps engineers, and organizations that need centralized artifact management with enterprise-grade database reliability but don't require the advanced features of commercial Artifactory versions. The combination delivers the performance benefits of PostgreSQL's advanced indexing and query optimization alongside NGINX's event-driven architecture, making it suitable for teams managing hundreds of artifacts daily across multiple repositories and package formats.

## Features

- Universal repository support for 30+ package types including Maven, Gradle, npm, Docker, NuGet, and PyPI with native metadata handling
- PostgreSQL backend providing ACID compliance, advanced indexing, and superior query performance compared to default Derby database
- NGINX reverse proxy with HTTP/2 support, SSL termination, and connection pooling for improved client performance
- Virtual and remote repository aggregation allowing unified access to multiple artifact sources through single endpoints
- Advanced artifact search capabilities with property-based filtering, checksum verification, and metadata querying
- REST API for automated artifact deployment, retrieval, and repository management with comprehensive CLI tools
- Built-in security scanning for open-source vulnerabilities in uploaded artifacts with detailed reporting
- Flexible permission system with repository-level access control and user group management

## Use cases

- Centralizing Maven and Gradle artifacts for Java development teams with automated dependency resolution
- Managing Docker images for containerized applications with registry federation and vulnerability scanning
- Hosting private npm packages alongside public registry proxying for Node.js development workflows
- Storing release binaries and deployment artifacts for CI/CD pipelines with automated retention policies
- Creating development team artifact sharing hub with role-based access control and audit trails
- Implementing artifact promotion workflows between development, staging, and production repositories
- Building on-premises artifact caching proxy to reduce external dependency download times and bandwidth

## Prerequisites

- Minimum 4GB RAM and 2 CPU cores recommended for production workloads handling moderate artifact traffic
- 20GB+ free disk space for artifact storage, with additional space planning based on binary retention requirements
- Ports 80, 443, 8081, and 8082 available for NGINX proxy and Artifactory service binding
- Basic understanding of repository management concepts including virtual, local, and remote repository types
- Familiarity with NGINX configuration for SSL certificate installation and custom domain setup
- PostgreSQL administration knowledge for backup configuration and performance tuning

## docker-compose.yml

```yaml
services:
  artifactory:
    image: releases-docker.jfrog.io/jfrog/artifactory-oss:latest
    environment:
      - JF_SHARED_DATABASE_TYPE=postgresql
      - JF_SHARED_DATABASE_DRIVER=org.postgresql.Driver
      - JF_SHARED_DATABASE_URL=jdbc:postgresql://postgres:5432/artifactory
      - JF_SHARED_DATABASE_USERNAME=${POSTGRES_USER}
      - JF_SHARED_DATABASE_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - artifactory-data:/var/opt/jfrog/artifactory
    ports:
      - "8082:8082"
      - "8081:8081"
    depends_on:
      - postgres
    networks:
      - artifactory-network
    restart: unless-stopped

  postgres:
    image: postgres:15
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=artifactory
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - artifactory-network
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - artifactory
    networks:
      - artifactory-network
    restart: unless-stopped

volumes:
  artifactory-data:
  postgres-data:

networks:
  artifactory-network:
    driver: bridge
```

## .env

```bash
# Artifactory
POSTGRES_USER=artifactory
POSTGRES_PASSWORD=secure_postgres_password

# Default admin: admin / password
```

## Usage notes

- Web UI at http://localhost:8082
- Default login: admin / password
- Configure repositories after login
- Supports Maven, Gradle, npm, Docker
- OSS version limited to certain types

## Troubleshooting

- Artifactory fails to start with database connection errors: Verify POSTGRES_USER and POSTGRES_PASSWORD environment variables match between services and ensure PostgreSQL is fully initialized before Artifactory startup
- Web UI shows 502 Bad Gateway errors: Check that Artifactory service is running on port 8082 and NGINX upstream configuration correctly points to artifactory:8082 internal address
- PostgreSQL container exits with permission denied errors: Ensure postgres-data volume has correct ownership (999:999) or initialize with proper user mapping using init containers
- Artifact uploads fail with insufficient storage errors: Monitor artifactory-data volume usage and implement cleanup policies for old artifacts or increase allocated storage
- Repository resolution extremely slow: Tune PostgreSQL memory settings in postgresql.conf, increase shared_buffers and work_mem based on available system RAM
- Docker registry push/pull operations timeout: Increase NGINX client_max_body_size directive and proxy timeout values to accommodate large container image transfers

