Skip to content

Commit

Permalink
Added support for OSS (#61)
Browse files Browse the repository at this point in the history
* Update artifactory-oss.yml

* Update prepareHostEnv.sh

* Update README.md
  • Loading branch information
jkiddo authored and eldada committed Mar 7, 2018
1 parent 5a9e843 commit d0a571a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ Artifactory data is shared on a common NFS mount.

#### Artifactory OSS standalone with built in Derby database
```bash
### Linux
$ sudo ./prepareHostEnv.sh -t oss -c
$ sudo docker-compose -f artifactory-oss.yml up -d
```
**IMPORTANT:** Make sure to prepare the needed [storage for persistent data](#persistent-storage)!
Expand All @@ -220,6 +222,8 @@ Artifactory uses the embedded DerbyDB database.

#### Artifactory OSS with PostgreSQL
```bash
### Linux
$ sudo ./prepareHostEnv.sh -t oss -c
$ sudo docker-compose -f artifactory-oss-postgresql.yml up -d
```
**IMPORTANT:** Make sure to prepare the needed [storage for persistent data](#persistent-storage)!
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/artifactory-oss.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3'
services:
artifactory:
image: docker.bintray.io/jfrog/artifactory-oss:5.9.1
Expand Down
15 changes: 10 additions & 5 deletions docker-compose/prepareHostEnv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ $0 - script for preparing the needed directories on the local host for mounting
Usage: $0 options
Supported options
-t : (Required) Deployment type. 'pro', 'ha' or 'ha-shared-data'
-t : (Required) Deployment type. 'pro', 'oss', 'ha' or 'ha-shared-data'
- pro : Single Pro node
- ha : HA with two nodes
- ha-shared-data : HA that uses a shared data mount
- oss : Single OSS node
-d : Custom root data directory (defaults to /data)
-c : Clean local data directory. Delete the data directory on the host before creating the new ones
-f : Force removal if -c is passed (do not prompt)
Expand All @@ -34,6 +35,9 @@ Examples
Prepare directories for Artifactory pro with default data directory
Start : sudo $0 -t pro -c
Prepare directories for Artifactory OSS with default data directory
Start : sudo $0 -t oss -c
Prepare a default HA deployment directories
Start : sudo $0 -t ha -c
Expand Down Expand Up @@ -67,7 +71,7 @@ processOptions() {
case $opt in
t) # Run type
TYPE=$OPTARG
if [[ ! "$TYPE" =~ ^(pro|ha|ha-shared-data)$ ]]; then
if [[ ! "$TYPE" =~ ^(pro|ha|ha-shared-data|oss)$ ]]; then
echo "ERROR: Deployment type $TYPE is not supported"
usage
fi
Expand All @@ -94,7 +98,7 @@ processOptions() {

# Make sure mandatory parameters are set
if [ -z "$TYPE" ]; then
echo "You must pass a deployment type (-t <pro|ha|ha-shared-data>)"
echo "You must pass a deployment type (-t <pro|ha|ha-shared-data|oss>)"
usage
fi

Expand Down Expand Up @@ -123,7 +127,7 @@ cleanDataDir () {
createDirectories () {
echo "Creating ${ROOT_DATA_DIR}"
mkdir -p ${ROOT_DATA_DIR}/postgresql
if [ "$TYPE" == "pro" ]; then
if [ "$TYPE" == "pro" ] || [ "$TYPE" == "oss" ]; then
mkdir -p ${ROOT_DATA_DIR}/artifactory/etc
else
mkdir -p ${ROOT_DATA_DIR}/artifactory/node{1,2}/etc
Expand All @@ -138,7 +142,7 @@ copyFiles () {
echo "Copying needed files to directories"

echo "Artifactory configuration files"
if [ "$TYPE" == "pro" ]; then
if [ "$TYPE" == "pro" ] || [ "$TYPE" == "oss" ]; then
cp -f ${SCRIPT_DIR}/../files/security/communication.key ${ROOT_DATA_DIR}/artifactory/etc
cp -fr ${SCRIPT_DIR}/../files/access ${ROOT_DATA_DIR}/artifactory/
else
Expand All @@ -158,6 +162,7 @@ copyFiles () {

echo "Nginx Artifactory configuration"
cp -fr ${SCRIPT_DIR}/../files/nginx/conf.d/${type}/* ${ROOT_DATA_DIR}/nginx/conf.d/

}

showNotes () {
Expand Down
38 changes: 38 additions & 0 deletions files/nginx/conf.d/oss/artifactory.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@




## add ssl entries when https has been set in config
ssl_certificate /etc/nginx/ssl/example.pem;
ssl_certificate_key /etc/nginx/ssl/example.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\.artifactory artifactory;

if ($http_x_forwarded_proto = '') {
set $http_x_forwarded_proto $scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
rewrite ^/$ /artifactory/webapp/ redirect;
rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
chunked_transfer_encoding on;
client_max_body_size 0;
location /artifactory/ {
proxy_read_timeout 900;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://artifactory:8081/artifactory/;
proxy_set_header X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

0 comments on commit d0a571a

Please sign in to comment.