working with postges
diff --git a/README.rst b/README.rst
index 037ddee..cee7261 100644
--- a/README.rst
+++ b/README.rst
@@ -33,6 +33,20 @@
         source:
           engine: pkg
 
+Single artifactory with PostgreSQL database
+
+.. code-block:: yaml
+
+    artifactory:
+      server:
+        database:
+          engine: postgresql
+          host: localhost
+          port: 5432
+          name: artifactory
+          user: artifactory
+          password: pass
+
 
 Development and testing
 =======================
@@ -69,8 +83,8 @@
   make kitchen
 
 
-
 Read more
 =========
 
 * https://www.jfrog.com/confluence/display/RTF/Debian+Repositories
+* https://www.jfrog.com/confluence/display/RTF/PostgreSQL
\ No newline at end of file
diff --git a/artifactory/files/artifactory.conf b/artifactory/files/artifactory.conf
deleted file mode 100644
index 44e3449..0000000
--- a/artifactory/files/artifactory.conf
+++ /dev/null
@@ -1 +0,0 @@
-# Service config file
\ No newline at end of file
diff --git a/artifactory/files/artifactory.config.bootstrap.xml b/artifactory/files/artifactory.config.bootstrap.xml
new file mode 100644
index 0000000..5a34bc0
--- /dev/null
+++ b/artifactory/files/artifactory.config.bootstrap.xml
@@ -0,0 +1,301 @@
+{%- from "artifactory/map.jinja" import server with context -%}
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- // @formatter:off -->
+
+<!--
+  ~ Artifactory is a binaries repository manager.
+  ~ Copyright (C) 2016 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/>.
+  -->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns="http://artifactory.jfrog.org/xsd/1.7.8"
+        xsi:schemaLocation="http://artifactory.jfrog.org/xsd/1.7.8
+        http://www.jfrog.org/xsd/artifactory-v1_7_8.xsd">
+<!--
+    enable/disable anonymous downloads
+    -->
+    <security>
+        <anonAccessEnabled>true</anonAccessEnabled>
+        <anonAccessToBuildInfosDisabled>false</anonAccessToBuildInfosDisabled>
+        <hideUnauthorizedResources>false</hideUnauthorizedResources>
+        <passwordSettings>
+            <encryptionPolicy>supported</encryptionPolicy>
+            <expirationPolicy>
+                <enabled>false</enabled>
+                <passwordMaxAge>60</passwordMaxAge>
+                <notifyByEmail>true</notifyByEmail>
+            </expirationPolicy>
+        </passwordSettings>
+        <ldapSettings/>
+        <ldapGroupSettings/>
+        <userLockPolicy>
+            <enabled>false</enabled>
+            <loginAttempts>5</loginAttempts>
+        </userLockPolicy>
+    </security>
+    <backups>
+        <backup>
+            <key>backup-daily</key>
+            <!-- backup Monday to Friday at 2:00 AM -->
+            <cronExp>0 0 2 ? * MON-FRI</cronExp>
+            <!-- Always backup to a "current" dir (incremental backups) -->
+            <retentionPeriodHours>0</retentionPeriodHours>
+            <!-- exclude certain repositories from being backed up -->
+            <excludedRepositories>
+                <repositoryRef>jcenter</repositoryRef>
+            </excludedRepositories>
+        </backup>
+        <backup>
+            <key>backup-weekly</key>
+            <enabled>false</enabled>
+            <!-- backup on Saturday at 2:00 AM -->
+            <cronExp>0 0 2 ? * SAT</cronExp>
+            <!-- keep backups for 2 weeks. -->
+            <retentionPeriodHours>336</retentionPeriodHours>
+            <!-- exclude certain repositories from being backed up -->
+            <excludedRepositories>
+                <repositoryRef>jcenter</repositoryRef>
+            </excludedRepositories>
+        </backup>
+    </backups>
+
+    <!-- The interval at which to activate the maven indexer. -->
+    <indexer>
+        <!-- By Default index once a day at 05:23AM -->
+        <cronExp>0 23 5 * * ?</cronExp>
+    </indexer>
+
+    <localRepositories>
+        <localRepository>
+            <key>libs-release-local</key>
+            <type>maven</type>
+            <description>Local repository for in-house libraries</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>true</handleReleases>
+            <handleSnapshots>false</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+        <localRepository>
+            <key>libs-snapshot-local</key>
+            <type>maven</type>
+            <description>Local repository for in-house snapshots</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>false</handleReleases>
+            <handleSnapshots>true</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+        <localRepository>
+            <key>plugins-release-local</key>
+            <type>maven</type>
+            <description>Local repository for plugins</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>true</handleReleases>
+            <handleSnapshots>false</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+        <localRepository>
+            <key>plugins-snapshot-local</key>
+            <type>maven</type>
+            <description>Local repository for plugins snapshots</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>false</handleReleases>
+            <handleSnapshots>true</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+        <localRepository>
+            <key>ext-release-local</key>
+            <type>maven</type>
+            <description>Local repository for third party libraries</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>true</handleReleases>
+            <handleSnapshots>false</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+        <localRepository>
+            <key>ext-snapshot-local</key>
+            <type>maven</type>
+            <description>Local repository for third party snapshots</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>false</handleReleases>
+            <handleSnapshots>true</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+        </localRepository>
+    </localRepositories>
+
+    <remoteRepositories>
+        <remoteRepository>
+            <key>jcenter</key>
+            <type>maven</type>
+            <description>Bintray Central Java repository</description>
+            <repoLayoutRef>maven-2-default</repoLayoutRef>
+            <handleReleases>true</handleReleases>
+            <handleSnapshots>false</handleSnapshots>
+            <suppressPomConsistencyChecks>false</suppressPomConsistencyChecks>
+            <url>http://jcenter.bintray.com</url>
+            <blockMismatchingMimeTypes>true</blockMismatchingMimeTypes>
+        </remoteRepository>
+    </remoteRepositories>
+
+    <virtualRepositories>
+        <!-- This repository will be available at the url:
+        http://<host>:<port>/artifactory/snapshots-only/
+        (note the trailing slash!)
+        -->
+        <virtualRepository>
+            <key>remote-repos</key>
+            <type>maven</type>
+            <artifactoryRequestsCanRetrieveRemoteArtifacts>true</artifactoryRequestsCanRetrieveRemoteArtifacts>
+            <repositories>
+                <repositoryRef>jcenter</repositoryRef>
+            </repositories>
+        </virtualRepository>
+        <virtualRepository>
+            <key>libs-release</key>
+            <type>maven</type>
+            <repositories>
+                <repositoryRef>libs-release-local</repositoryRef>
+                <repositoryRef>ext-release-local</repositoryRef>
+                <repositoryRef>remote-repos</repositoryRef>
+            </repositories>
+        </virtualRepository>
+        <virtualRepository>
+            <key>plugins-release</key>
+            <type>maven</type>
+            <repositories>
+                <repositoryRef>plugins-release-local</repositoryRef>
+                <repositoryRef>ext-release-local</repositoryRef>
+                <repositoryRef>remote-repos</repositoryRef>
+            </repositories>
+        </virtualRepository>
+        <virtualRepository>
+            <key>libs-snapshot</key>
+            <type>maven</type>
+            <repositories>
+                <repositoryRef>libs-snapshot-local</repositoryRef>
+                <repositoryRef>ext-snapshot-local</repositoryRef>
+                <repositoryRef>remote-repos</repositoryRef>
+            </repositories>
+        </virtualRepository>
+        <virtualRepository>
+            <key>plugins-snapshot</key>
+            <type>maven</type>
+            <repositories>
+                <repositoryRef>plugins-snapshot-local</repositoryRef>
+                <repositoryRef>ext-snapshot-local</repositoryRef>
+                <repositoryRef>remote-repos</repositoryRef>
+            </repositories>
+        </virtualRepository>
+    </virtualRepositories>
+
+    <repoLayouts>
+        <repoLayout>
+            <name>maven-2-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
+            <descriptorPathPattern>[orgPath]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).pom</descriptorPathPattern>
+            <folderIntegrationRevisionRegExp>SNAPSHOT</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>SNAPSHOT|(?:(?:[0-9]{8}.[0-9]{6})-(?:[0-9]+))</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>ivy-default</name>
+            <artifactPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[type]s/[module](-[classifier])-[baseRev](-[fileItegRev]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
+            <descriptorPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[type]s/ivy-[baseRev](-[fileItegRev]).xml</descriptorPathPattern>
+            <folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>gradle-default</name>
+            <artifactPathPattern>[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
+            <descriptorPathPattern>[org]/[module]/ivy-[baseRev](-[fileItegRev]).xml</descriptorPathPattern>
+            <folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>maven-1-default</name>
+            <artifactPathPattern>[org]/[type]s/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
+            <descriptorPathPattern>[org]/[type]s/[module]-[baseRev](-[fileItegRev]).pom</descriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.+</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>.+</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>nuget-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[module].[baseRev](-[fileItegRev]).nupkg</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>npm-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).tgz</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>bower-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[module]-[baseRev](-[fileItegRev]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>vcs-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[refs&lt;tags|branches&gt;]/[baseRev]/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>[a-zA-Z0-9]{40}</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>sbt-default</name>
+            <artifactPathPattern>[org]/[module]/(scala_[scalaVersion&lt;.+&gt;])/(sbt_[sbtVersion&lt;.+&gt;])/[baseRev]/[type]s/[module](-[classifier]).[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>true</distinctiveDescriptorPathPattern>
+            <descriptorPathPattern>[org]/[module]/(scala_[scalaVersion&lt;.+&gt;])/(sbt_[sbtVersion&lt;.+&gt;])/[baseRev]/[type]s/ivy.xml</descriptorPathPattern>
+            <folderIntegrationRevisionRegExp>\d{14}</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>\d{14}</fileIntegrationRevisionRegExp>
+        </repoLayout>
+        <repoLayout>
+            <name>simple-default</name>
+            <artifactPathPattern>[orgPath]/[module]/[module]-[baseRev].[ext]</artifactPathPattern>
+            <distinctiveDescriptorPathPattern>false</distinctiveDescriptorPathPattern>
+            <folderIntegrationRevisionRegExp>.*</folderIntegrationRevisionRegExp>
+            <fileIntegrationRevisionRegExp>.*</fileIntegrationRevisionRegExp>
+        </repoLayout>
+    </repoLayouts>
+    <gcConfig>
+        <cronExp>0 0 /4 * * ?</cronExp>
+    </gcConfig>
+    <cleanupConfig>
+        <!-- by default cleanup once a day at 05:12AM -->
+        <cronExp>0 12 5 * * ?</cronExp>
+    </cleanupConfig>
+    <virtualCacheCleanupConfig>
+        <!-- by default cleanup once a day at 05:00AM -->
+        <cronExp>0 12 0 * * ?</cronExp>
+    </virtualCacheCleanupConfig>
+    <folderDownloadConfig>
+        <enabled>false</enabled>
+        <maxDownloadSizeMb>1024</maxDownloadSizeMb>
+        <maxFiles>5000</maxFiles>
+        <maxConcurrentRequests>10</maxConcurrentRequests>
+    </folderDownloadConfig>
+    <trashcanConfig>
+        <enabled>true</enabled>
+        <allowPermDeletes>false</allowPermDeletes>
+        <retentionPeriodDays>14</retentionPeriodDays>
+    </trashcanConfig>
+</config>
diff --git a/artifactory/files/artifactory.system.properties b/artifactory/files/artifactory.system.properties
new file mode 100644
index 0000000..d92373d
--- /dev/null
+++ b/artifactory/files/artifactory.system.properties
@@ -0,0 +1,278 @@
+{%- from "artifactory/map.jinja" import server with context %}
+#
+#
+# Artifactory is a binaries repository manager.
+# Copyright (C) 2016 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/>.
+#
+#
+
+###############################################################################
+#  Use this file to override system-level properties used by artifactory.     #
+#  Artifactory-specific properties beginning with the "artifactory." prefix   #
+#  will be handled internally by artifactory - you should change them only if #
+#  you know what you are doing.                                               #
+#  All other properties will become normal (jvm-wide) system properties, so   #
+#  this file can be used as an alternative for specifying command-line         #
+#  -Dparam=val parameters.                                                    #
+###############################################################################
+
+## Comma separated list of disabled addons
+#artifactory.addons.disabled=
+
+## Name of alternate application context class to use
+#artifactory.applicationContextClass=null
+
+# Enable adding the session id to the URL
+#artifactory.servlet.supportUrlSessionTracking=false
+
+## Indicates whether a different instance of Artifactory can request remote artifacts from this instance
+#artifactory.artifactoryRequestsToGlobalCanRetrieveRemoteArtifacts=false
+
+## Disable the download access to the global 'repo'
+artifactory.repo.global.disabled=true
+
+## Number of seconds for fs items to idle in the cache
+#artifactory.fsitem.cache.idleTimeSecs=1200
+
+## Number of seconds to wait between running the storage garbage collector. Use the UI to configure as cron exp
+#artifactory.gc.intervalSecs=14400
+
+## Number of milliseconds the garbage collector should wait between the scanning of each node
+#artifactory.gc.sleepBetweenNodesMillis=20
+
+## Number of milliseconds to wait before starting to sleep between garbage collector node scanning iterations
+#artifactory.gc.scanStartSleepingThresholdMillis=20000
+
+## Number of milliseconds to sleep between garbage collector node scanning iterations
+#artifactory.gc.scanSleepBetweenIterationsMillis=200
+
+## Number of milliseconds to work between garbage collector datastore file scanning sleep invocations
+#artifactory.gc.fileScanSleepIterationMillis=1000
+
+## Number of milliseconds to sleep during lengthy garbage collector datastore file scanning
+#artifactory.gc.fileScanSleepMillis=250
+
+## The maximum binary record cache entries. Apllicable only for v2 gc
+#artifactory.gc.maxCacheEntries=10000
+
+## Number of seconds to wait until timing out while waiting for an item lock to be acquired
+#artifactory.locks.timeoutSecs=120
+
+## Whether to print detailed debug information on lock timeouts
+#artifactory.locks.debugTimeouts=false
+
+## Number of seconds to wait between each refresh of the system logs viewer
+#artifactory.logs.viewRefreshRateSecs=10
+
+## The maximum number of seconds to wait when blocking on a concurrent download from the same repository, before
+## starting a parallel download
+# artifactory.repo.concurrentDownloadSyncTimeoutSecs=900
+
+## Indicates if all stored archives should be indexed (even if already done) upon system startup
+#artifactory.search.content.forceArchiveIndexing=false
+
+## Maximum number of excerpt fragments to return for each result when searching archive content through the UI
+#artifactory.search.content.maxFragments=500
+
+## Maximum number of characters for each fragment
+#artifactory.search.content.maxFragmentsSize=5000
+
+## Maximum number of results to return when searching through the UI
+#artifactory.search.maxResults=500
+
+## The backend limit of maximum results to return from sql queries issued by users. Should be higher than maxResults.
+#artifactory.search.userQueryLimit=1000
+
+## The minimum number of characters allowed for an archive content query.
+#artifactory.search.archive.minQueryLength=3
+
+## The maximum number of seconds that should be spent on a pattern search
+#artifactory.search.pattern.timeoutSecs=30
+
+## Number of seconds for authentications to idle in the cache
+#artifactory.security.authentication.cache.idleTimeSecs=300
+
+## Minimal number of seconds that should be the difference between each user last access timestamp 
+#artifactory.security.userLastAccessUpdatesResolutionSecs=60
+
+## If Login Remember Me should be disabled and users will have to input their credentials on each login.
+#artifactory.security.disableRememberMe=false
+
+## Caches blocked user in sake of performance improvement
+## and takes load off authentication mechanism/db
+#artifactory.security.useFrontCacheForBlockedUsers=true
+
+## Login dynamically blocked for increasing amount of time
+## since third incorrect login, algorithm is:
+## (INCORRECT_ATTEMPTS-3) * loginBlockDelay (millis)
+##
+## note: delay may not exceed 5000 (5 seconds)
+##
+#artifactory.security.loginBlockDelay=500
+
+## Path to alternate Spring configuration file
+#artifactory.spring.configDir=null
+
+## Number of lock timeouts to retry while waiting for a task to complete
+#artifactory.task.completionLockTimeoutRetries=100
+
+## Whether logging and processing of traffic is active  
+#artifactory.traffic.collectionActive=false
+
+## Number of seconds to wait between each version information update query
+#artifactory.versioningQueryIntervalSecs=43200
+
+## The substring by which a remote host is identified as Maven''s central host
+#artifactory.mvn.central.hostPattern=.maven.org
+
+## The maximum frequency in seconds that a remote index on Maven central host can be queried for updates
+#artifactory.mvn.central.indexerMaxQueryIntervalSecs=86400
+## Maximum concurrent workers to calculate maven metadata
+#artifactory.mvn.metadata.calculation.workers=8
+
+## Fully qualified name of a maven metadata version comparator to determine the latest and release versions
+#artifactory.mvn.metadataVersionsComparatorFqn=org.artifactory.maven.versioning.VersionNameMavenMetadataVersionComparator
+
+## Disable requests with version tokens (SNAPSHOT, [RELEASE], [INTEGRATION] which retrieves the latest unique if exists
+#artifactory.request.disableVersionTokens=false
+
+## Determine if should sort and retrieve the latest [RELEASE] version by files date created (default is by version string comparator)
+#artifactory.request.searchLatestReleaseByDateCreated=false
+
+## Add additional xml mime type file extensions (*.myextension). Separated by ","
+#artifactory.xmlAdditionalMimeTypeExtensions=myextension1,myextension2
+
+## Max number of folders to scan deeply for items used as build artifact or dependencies before deleting to warn of
+#artifactory.build.maxFoldersToScanForDeletionWarnings=2
+
+## Size for the derby page cache
+derby.storage.pageCacheSize=500
+
+## Disable the Derby JMX management service
+derby.module.mgmt.jmx=org.apache.derby.impl.services.jmxnone.NoManagementService
+
+## Log all errors/messages of any severity (will list deadlocks)
+derby.stream.error.logSeverityLevel=0
+
+## Log all executed statements along with their txid
+derby.language.logStatementText=false
+
+## Log all deadlocks
+#derby.locks.monitor=true
+
+## Writes a stack trace of all threads involved in lock problems # -- (not just the victims) to the log
+#derby.locks.deadlockTrace=true
+
+## Threshold for the number rows touched above which to auto-escalate to table-level locking from row-level locking
+#derby.locks.escalationThreshold=5000
+
+## Defines the maximum size of text to parse through the text highlighting script
+#artifactory.ui.syntaxColoringMaxTextSizeBytes=512000
+
+## Defines the default chroot for UI file\dir selectors that browse machine Artifactory was installed on
+#artifactory.ui.chroot=/home/bob
+
+## Defines the maximum number of files to retain when maintaining a rolling file policy
+#artifactory.file.roller.maxFileToRetain=10
+
+## Number of milliseconds to work between system backup file export sleep invocations
+#artifactory.backup.fileExportSleepIterationMillis=2000
+
+## Number of milliseconds to sleep during lengthy system backup file exports
+#artifactory.backup.fileExportSleepMillis=250
+
+## Number of seconds to check for updates of plugin script files (0 - do not refresh updates scripts)
+#artifactory.plugin.scripts.refreshIntervalSecs=0
+
+## Send the Accept-Encoding:gzip header to remote repositories and handle gzip stream responses
+#artifactory.http.acceptEncoding.gzip=true
+
+# use the Expect continue directive
+#artifactory.http.useExpectContinue=false
+
+# The lower-limit of a filtered resource size for which a performance warning will be displayed
+#filtering.resourceSizeKb=64
+
+# Whether to search for an an existing resource under a different name before requesting a remote artifact
+#artifactory.repo.remote.checkForExistingResourceOnRequest=true
+
+# Comma separated list of global excludes to apply on all repositories
+#artifactory.repo.includeExclude.globalExcludes=**/*~,**/#*#,**/.#*,**/%*%,**/._*,**/CVS,**/CVS/**,**/.cvsignore,**/SCCS,**/SCCS/**,**/vssver.scc,**/.svn,**/.svn/**,**/.DS_Store
+
+## A list of archive file names that may contain textual license information.\
+#artifactory.archive.licenseFile.names=license,LICENSE,license.txt,LICENSE.txt,LICENSE.TXT
+
+## Number of seconds for dynamic metadata to be cached
+#artifactory.mvn.dynamicMetadata.cacheRetentionSecs=10
+
+## A list of custom types (custom file extensions) to use when resolving maven artifacts
+#artifactory.mvn.custom.types=tar.gz,tar.bz2
+
+## Determines the maximum number of rows to display per result page
+#artifactory.ui.search.maxRowsPerPage=20
+
+## Maximum number of results to return when performing NuGet searches without specifying a limit
+#artifactory.nuget.search.maxResults=100
+
+## If true, all requests to the NuGet API require authentication even if anonymous access is enabled.
+#artifactory.nuget.forceAuthentication=false
+
+## Disable filename token in response Content-Disposition header
+#artifactory.response.disableContentDispositionFilename=false
+
+## Comma separated list of supported archive extensions for archive bundled deploy
+#artifactory.request.explodedArchiveExtensions=zip,tar,tar.gz,tgz
+
+## Disable \ enable the username auto complete in the login page  (values : "off" "on").
+#artifactory.useUserNameAutoCompleteOnLogin=on
+
+## The interval, in seconds, for flushing aggregated statistics to the storage
+#artifactory.stats.flushIntervalSecs=30
+
+## The amount of indices to pre fetch by IdGenerator
+#artifactory.db.idGenerator.fetch.amount=1000
+
+## Hides push to Bintray button both for artifacts as well as for builds
+#artifactory.bintray.ui.hideUploads=true
+
+## Hides the encrypted password field and the maven settings snippet from the profile page
+#artifactory.ui.hideEncryptedPassword=true
+
+## Hides checksum files in simple and list browsing
+#artifactory.ui.hideChecksums=true
+
+## Maximum number repositories to import in parallel (default is one less than the available processors)
+#artifactory.import.max.parallelRepos
+
+## Idle connection monitor interval (in seconds)
+#artifactory.repo.http.idleConnectionMonitorInterval=10
+
+## Disables idle HTTP connections monitoring (idle connections are closed automatically when #idleConnectionMonitorInterval expires)
+#artifactory.repo.http.disableIdleConnectionMonitoring=false
+
+## Time to wait for content collection accomplishing (in minutes)
+#artifactory.support.core.bundle.contentCollectionAwaitTimeout=60
+
+## Artifactory by default blocks concurrent execution of Support content collection,
+## however one can configure time to wait for next available execution slot before
+## withdraw (in seconds)
+#artifactory.support.core.bundle.waitForSlotBeforeWithdraw=600
+
+## Max (previously created) bundles to keep
+#artifactory.support.core.bundle.maxBundles=5
+
+
+
diff --git a/artifactory/files/storage.properties b/artifactory/files/storage.properties
new file mode 100644
index 0000000..01142ab
--- /dev/null
+++ b/artifactory/files/storage.properties
@@ -0,0 +1,55 @@
+{%- from "artifactory/map.jinja" import server with context %}
+#
+#
+# Artifactory is a binaries repository manager.
+# Copyright (C) 2016 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/>.
+#
+#
+
+{% if server.database.engine == 'derby' %}
+
+type=derby
+url=jdbc:derby:{db.home};create=true
+driver=org.apache.derby.jdbc.EmbeddedDriver
+
+{%- elif server.database.engine == 'postgresql' %}
+
+type=postgresql
+driver=org.postgresql.Driver
+url=jdbc:postgresql://{{ server.database.host }}:{{ server.database.port }}/{{ server.database.name }}
+username={{ server.database.user }}
+password={{ server.database.password }}
+
+{%- elif server.database.engine == 'mysql' %}
+
+type=mysql
+driver=com.mysql.jdbc.Driver
+url=jdbc:mysql://{{ server.database.host }}:{{ server.database.port }}/{{ server.database.name }}?characterEncoding=UTF-8&elideSetAutoCommits=true
+username={{ server.database.user }}
+password={{ server.database.password }}
+
+{%- endif %}
+
+## Determines where the actual artifacts binaries are stored. Available options:
+## filesystem - binaries are stored in the filesystem (recommended, default)
+## fullDb     - binaries are stored as blobs in the db, filesystem is used for caching
+## cachedFS   - binaries are stored in the filesystem, but a front cache (with faster access) is added
+## IMPORTANT NOTE: This property should not be change after the initial setup. To change binaries storage you have to export and import
+#binary.provider.type=filesystem
+
+## Determines the maximum filesystem cache size in bytes when using binary provider type fullDb or cachedFS. Default is 5GB
+## Supported units are TB (terabytes), GB (gigabytes), MB (megabytes) and KB (kilobytes)
+#binary.provider.cache.maxSize=5GB
\ No newline at end of file
diff --git a/artifactory/map.jinja b/artifactory/map.jinja
index d0d6260..4fa4f92 100644
--- a/artifactory/map.jinja
+++ b/artifactory/map.jinja
@@ -5,9 +5,19 @@
 Debian:
   pkgs:
   - jfrog-artifactory-{{ source_edition }}
+  service: artifactory
+  lib:
+    postgresql: https://jdbc.postgresql.org/download/postgresql-9.4.1209.jre6.jar
+  database:
+    engine: derby
 RedHat:
   pkgs:
   - jfrog-artifactory-{{ source_edition }}
+  service: artifactory
+  lib:
+    postgresql: https://jdbc.postgresql.org/download/postgresql-9.4.1209.jre6.jar
+  database:
+    engine: derby
 {%- endload %}
 
 {%- set server = salt['grains.filter_by'](base_defaults, merge=salt['pillar.get']('artifactory:server')) %}
\ No newline at end of file
diff --git a/artifactory/server.sls b/artifactory/server.sls
index 9c85e72..852efa8 100644
--- a/artifactory/server.sls
+++ b/artifactory/server.sls
@@ -1,4 +1,37 @@
 {%- from "artifactory/map.jinja" import server with context %}
 {%- if server.enabled %}
 
+artifactory_packages:
+  pkg.installed:
+  - names: {{ server.pkgs }}
+
+artifactory_storage_config:
+  file.managed:
+  - name: /etc/opt/jfrog/artifactory/storage.properties
+  - source: salt://artifactory/files/storage.properties
+  - template: jinja
+  - require:
+    - pkg: artifactory_packages
+  - watch_in:
+    - service: artifactory_service
+
+{%- if server.database.engine == "postgresql" %}
+
+artifactory_lib_postresql:
+  file.managed:
+  - name: /var/opt/jfrog/artifactory/tomcat/lib/postgresql.jar
+  - source: {{ server.lib.postgresql }}
+  - skip_verify: True
+  - require:
+    - pkg: artifactory_packages
+  - watch_in:
+    - service: artifactory_service
+
+{%- endif %}
+
+artifactory_service:
+  service.running:
+  - name: {{ server.service }}
+  - enable: true
+
 {%- endif %}
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
index e7fea72..631ba65 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -3,8 +3,15 @@
 classes:
 - service.artifactory.support
 parameters:
+  _param:
+    artifactory_edition: oss
   artifactory:
     server:
       enabled: true
       bind:
         address: 0.0.0.0
+      edition: ${_param:artifactory_edition}
+      version: 4
+      source:
+        engine: pkg
+
diff --git a/metadata/service/vendor_repo/oss_xenial.yml b/metadata/service/vendor_repo/oss_xenial.yml
new file mode 100644
index 0000000..97cc635
--- /dev/null
+++ b/metadata/service/vendor_repo/oss_xenial.yml
@@ -0,0 +1,8 @@
+parameters:
+  linux:
+    system:
+      repo:
+        artifactory:
+          enabled: true
+          source: 'deb https://jfrog.bintray.com/artifactory-debs xenial main'
+          key_url: 'https://bintray.com/user/downloadSubjectPublicKey?username=jfrog'
diff --git a/metadata/service/vendor_repo/pro_xenial.yml b/metadata/service/vendor_repo/pro_xenial.yml
new file mode 100644
index 0000000..61bcedf
--- /dev/null
+++ b/metadata/service/vendor_repo/pro_xenial.yml
@@ -0,0 +1,8 @@
+parameters:
+  linux:
+    system:
+      repo:
+        artifactory:
+          enabled: true
+          source: 'deb https://jfrog.bintray.com/artifactory-pro-debs xenial main'
+          key_url: 'https://bintray.com/user/downloadSubjectPublicKey?username=jfrog'