Skip to content

Latest commit

 

History

History
192 lines (143 loc) · 6.79 KB

File metadata and controls

192 lines (143 loc) · 6.79 KB

Artifactory Docker Compose Examples

This directory provides some examples that show different ways to run Artifactory with Docker Compose.

Docker and Docker Compose

To learn more about Docker and how to set it up, please refer to the Docker and Docker Compose documentation.

Artifactory Docker Images

Artifactory is available as different Docker images for:

These images are available for download from JFrog Bintray.

Docker Compose Examples

To run any of the examples, you should execute:

$ docker-compose -f <compose-file> <options>

Docker Compose Control Commands

  • Start
$ sudo docker-compose -f <compose-file> up -d
  • Stop
$ sudo docker-compose -f <compose-file> stop
  • Restart
$ sudo docker-compose -f <compose-file> restart
  • Status
$ sudo docker-compose -f <compose-file> ps
  • Logs
$ sudo docker-compose -f <compose-file> logs
  • Remove
$ sudo docker-compose -f <compose-file> rm

Persistent Storage

For persistent storage, all volumes are mounted from the host.
All examples default to the host's /data directory
IMPORTANT: You should create the directories on the host before running docker-compose.

  • Artifactory data: /data/artifactory
    • In the case of HA, you need to create a data directory for each node: /data/artifactory/node1 and /data/artifactory/node2
    • In the case of HA with shared data storage, you need to create the shared data and backup directories: /data/artifactory/ha and /data/artifactory/backup
  • PostgreSQL data: /data/postgresql
  • NginX
    • Logs: /data/nginx/log
    • SSL: /data/nginx/ssl

To help with setting up of directories and files for Artifactory Pro and HA, there is a helper script prepareHostEnv.sh you should run.
This script prepares the needed directories on the host and populates them with example files. Get the usage by running it with -h

sudo ./prepareHostEnv.sh -h

After executing the script, the needed set of data directories for Artifactory Pro or HA will be created under /data (on Mac it defaults to ~/.artifactory).


Database Driver

The database used in these examples is PostgreSQL. For Artifactory to communicate with the database, it needs the database driver mounted into its Tomcat's lib directory.
You need to download the PostgreSQL driver (jar file) from PostgreSQL download page to your home directory.
Direct link to driver: https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar
In all examples using PostgreSQL, the file is mounted like this:
~/postgresql-9.4.1212.jar:/opt/jfrog/artifactory/tomcat/lib/postgresql-9.4.1212.jar

Using Different Databases

Artifactory can run with other databases. For more details on supported databases and how to set them up for use with Artifactory, please refer to Changing the Database in the JFrog Artifactory Use Guide.


Examples

Below is a list of included examples. You are welcome to contribute.

IMPORTANT: The files under the files directory included in this repository are for example purposes only and should NOT be used for any production deployments!


Artifactory Pro and HA

Artifactory Pro and HA require some more setup due to the built in support for simple and complex configurations.

Artifactory Pro with PostgreSQL and Nginx for https support

$ sudo ./prepareHostEnv.sh -t pro -c
$ sudo docker-compose -f artifactory-pro.yml up -d

This example starts the following containers

  • Nginx exposed on ports 80 and 443
    • You can disable port 80 in Nginx's configuration files
    • Nginx comes with self signed SSL certificates that can be overwritten
  • Artifactory Pro exposed on port 8081
  • PostgreSQL database serving Artifactory

Artifactory Pro with PostgreSQL only

$ sudo ./prepareHostEnv.sh -t pro -c
$ sudo docker-compose -f artifactory-pro-postgresql.yml up -d

This example starts the following containers

  • Artifactory Pro exposed on port 80
  • PostgreSQL database serving Artifactory

Artifactory uses the PostgreSQL database running in another container.

Artifactory HA with PostgreSQL and Nginx for load balancing and https support

$ sudo ./prepareHostEnv.sh -t ha -c
$ sudo docker-compose -f artifactory-ha.yml up -d

This example starts the following containers

  • Nginx exposed on ports 80 and 443
    • You can disable port 80 in Nginx's configuration files
    • Nginx comes with self signed SSL certificates that can be overwritten
    • Nginx is configured to load balance the two Artifactory instances
  • Artifactory primary exposed on port 8081 using its own data storage
  • Artifactory node exposed on port 8082 using its own data storage
  • PostgreSQL database serving Artifactory

Artifactory data is stored on a binary store provider and no shared NFS is needed.
I this example, the HA nodes use their local storage and sync data between the nodes.

Artifactory HA with PostgreSQL and Nginx for load balancing and https support with shared data storage (NFS)

$ sudo ./prepareHostEnv.sh -t ha-shared-data -c
$ sudo docker-compose -f artifactory-ha-shared-data.yml up -d

This example starts the following containers

  • Nginx exposed on ports 80 and 443
    • You can disable port 80 in Nginx's configuration files
    • Nginx comes with self signed SSL certificates that can be overwritten
    • Nginx is configured to load balance the two Artifactory instances
  • Artifactory primary exposed on port 8081
  • Artifactory node exposed on port 8082
  • PostgreSQL database serving Artifactory

Artifactory data is shared on a common NFS mount.


Artifactory OSS

Artifactory OSS standalone with built in Derby database

$ sudo docker-compose -f artifactory-oss.yml up -d

IMPORTANT: Make sure to prepare the needed storage for persistent data!

This example starts the following containers

  • Artifactory OSS exposed on port 80

Artifactory uses the embedded DerbyDB database.

Artifactory OSS with PostgreSQL

$ sudo docker-compose -f artifactory-oss-postgresql.yml up -d

IMPORTANT: Make sure to prepare the needed storage for persistent data!

This example starts the following containers

  • Artifactory OSS exposed on port 80
  • PostgreSQL database serving Artifactory

Artifactory uses the PostgreSQL database running in another container.