-
Notifications
You must be signed in to change notification settings - Fork 1
PostgreSQL
Leonard Carcaramo edited this page Apr 15, 2021
·
1 revision
This guide explains how to get a PostgreSQL container up and running on zCX, and how to make Artifactory use it.
- Pull the PostgreSQL image from IBM Z Curated Container Registry.
docker pull icr.io/ibmz/postgres:<version>
- Run a container using the
icr.io/ibmz/postgres:<version>
image you just pulled. Ensure you pass in a value for the POSTGRES_USER and POSTGRES_PASSWORD environment variables using the -e flag to setup PostgreSQL for Artifactory. Note that we are explicitely starting the PostgreSQL container as the postgres user. We are doing this because by default, the PostgreSQL container starts as root, which can cause permissions issues.
$ docker run --name <container name> --user postgres -d -p 5432:5432 \
> -e POSTGRES_USER=<username> \
> -e POSTGRES_PASSWORD=<password> \
> icr.io/ibmz/postgres:<version>
⚠️ The PostgreSQL database MUST be running and available before you spin up an Artifactory container that uses that database.
- Spin up an Artifactory container ensuring that you pass in ALL of environment variables in the below command to properly configure Artifactory to use the PostgreSQL database you just spun up.
Note that Artifactory's
db.properties
file must not exist in order for this configuration to be applied. If you are running Artifactory using a Docker volume that already contains state, you will need to delete thedb.properties
file in that volume first.
$ docker run --name <container name> -d -p 8081:8081 \
> -e DB_TYPE=postgresql \
> -e DB_USER=<postgres user> \
> -e DB_PASSWORD=<postgres password> \
> -e DB_URL=jdbc:postgresql://<postgres host/ip>:5432/artifactory \
> icr.io/ibmz/jfrog-artifactory-oss:<version>
- Verify that everything is working properly.
$ docker logs <artifactory container name>
...
2020-07-28 14:55:46,128 [art-init] [INFO ] (o.a.w.s.ArtifactoryContextConfigListener:215) -
###########################################################
### Artifactory successfully started (8.180 seconds) ###
###########################################################
2020-07-28 14:55:56,084 [art-exec-10] [INFO ] (o.a.e.EventsLogCleanUpService:53) - Starting cleanup of old events from event log
2020-07-28 14:55:56,088 [art-exec-10] [INFO ] (o.a.e.EventsLogCleanUpService:74) - Cleanup of old events from event log finished
- Ensure that
db.properties
within the Artifactory container is properly configured for PostgreSQL.
$ docker exec -it <artifactory container name> bash
postgres@<container id>:/$ cd opt/jfrog/artifactory/etc
postgres@<container id>:/$ cat db.properties
#
#
# Artifactory is a binaries repository manager.
# Copyright (C) 2018 JFrog Ltd.
#
# Artifactory is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Artifactory is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Artifactory. If not, see <http://www.gnu.org/licenses/>.
#
#
type=postgresql
driver=org.postgresql.Driver
url=jdbc:postgresql://<postgres container ip>:5432/artifactory
username=<username>
password=(Encrypted password will appear here)
- Ensure that that the logs produced by the PostgreSQL container show that Artifactory is interacting with it sucessfully.
$ docker logs <postgres container name>
...
2020-07-28 14:54:49.482 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-07-28 14:54:49.482 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-07-28 14:54:49.484 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-07-28 14:54:49.494 UTC [64] LOG: database system was shut down at 2020-07-28 14:54:49 UTC
2020-07-28 14:54:49.497 UTC [1] LOG: database system is ready to accept connections
2020-07-28 14:55:37.534 UTC [73] ERROR: relation "db_properties" does not exist at character 15
2020-07-28 14:55:37.534 UTC [73] STATEMENT: SELECT * FROM db_properties
2020-07-28 14:55:46.089 UTC [75] ERROR: duplicate key value violates unique constraint "configs_pk"
2020-07-28 14:55:46.089 UTC [75] DETAIL: Key (config_name)=(artifactory.security.artifactory.key) already exists.
2020-07-28 14:55:46.089 UTC [75] STATEMENT: INSERT INTO configs (config_name, last_modified, data) VALUES($1, $2, $3)
- Home
- Getting Started
- Artifactory Setup:
- Using Artifactory:
-
zCX Production:
- Databases:
- SSL-TLS:
- Additional Considerations