Artifactory: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Pull Artifactory==
{|
'''Artifactory Latest'''
| valign="top" |
<syntaxhighlight lang="bash">
'''Linux:'''
docker pull docker.bintray.io/jfrog/artifactory-pro:latest
export JFROG_HOME=/srv/jfrog
docker pull docker.bintray.io/jfrog/artifactory-oss:latest
 
docker pull docker.bintray.io/jfrog/artifactory-cpp-ce
| valign="top" |
</syntaxhighlight>
'''MacOS:'''
export JFROG_HOME=$HOME/jfrog
|}
{| class="wikitable sortable"
|-
! Local location !! Container location  !! Usage
|-
| <code>$JFROG_HOME/artifactory7/var/</code> || <code>/var/opt/jfrog/artifactory</code> || For storing artifactory data
|}
 
<source lang="bash">
docker run -it --rm \
--publish 9040:8081 \
--publish 9041:8082 \
docker.bintray.io/jfrog/artifactory-oss:7.6.3 \
bin/bash
id; exit
</source>
 
<source lang="bash">
mkdir -p $JFROG_HOME/artifactory7/var/etc/
touch $JFROG_HOME/artifactory7/var/etc/system.yaml
chown -R 1030:1030 $JFROG_HOME/artifactory7/var
</source>
 
==Docker==
===Debian===
<source lang="bash" highlight="5,6">
docker run --detach \
--publish 9040:8081 \
--publish 9041:8082 \
--name artifactory \
--restart always \
--volume $JFROG_HOME/artifactory7/var/:/var/opt/jfrog/artifactory \
docker.bintray.io/jfrog/artifactory-oss:7.6.3
</source>
 
===CentOS===
<source lang="bash" highlight="5,6">
docker run --detach \
--publish 9040:8081 \
--publish 9041:8082 \
--name artifactory \
--restart always \
--volume $JFROG_HOME/artifactory7/var/:/var/opt/jfrog/artifactory:Z \
docker.bintray.io/jfrog/artifactory-oss:7.6.3
</source>


'''Artifactory 6.2.0'''
==Apache==
<syntaxhighlight lang="bash">
===Debian===
docker pull docker.bintray.io/jfrog/artifactory-pro:6.2.0
<code>vim /etc/apache2/sites-enabled/01-cid.chorke.org-le-ssl.conf</code>
docker pull docker.bintray.io/jfrog/artifactory-oss:6.2.0
<source lang="apache" highlight="5,8-10">
</syntaxhighlight>
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    SSLProxyVerify None
    ProxyPreserveHost On
    AllowEncodedSlashes On
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off
    SSLProxyCheckPeerExpire Off
    # more others config skipped


'''Artifactory 5.11.0'''
    <Location /ui>
<syntaxhighlight lang="bash">
        Order Allow,Deny
docker pull docker.bintray.io/jfrog/artifactory-pro:5.11.0
        Allow from all
docker pull docker.bintray.io/jfrog/artifactory-oss:5.11.0
        ProxyPass http://localhost:9041/ui nocanon
</syntaxhighlight>
        ProxyPassReverse http://localhost:9041/ui
    </Location>


'''Artifactory 5.10.4'''
    <Location /artifactory>
<syntaxhighlight lang="bash">
        Order Allow,Deny
docker pull docker.bintray.io/jfrog/artifactory-pro:5.10.4
        Allow from all
docker pull docker.bintray.io/jfrog/artifactory-oss:5.10.4
        ProxyPass http://localhost:9040/artifactory nocanon
</syntaxhighlight>
        ProxyPassReverse http://localhost:9040/artifactory
    </Location>


'''Artifactory 4.1.0'''
    Include /etc/letsencrypt/options-ssl-apache.conf
<syntaxhighlight lang="bash">
    SSLCertificateFile /etc/letsencrypt/live/cid.chorke.org/cert.pem
docker pull docker.bintray.io/jfrog/artifactory-pro:4.1.0
    SSLCertificateKeyFile /etc/letsencrypt/live/cid.chorke.org/privkey.pem
docker pull docker.bintray.io/jfrog/artifactory-oss:4.1.0
    SSLCertificateChainFile /etc/letsencrypt/live/cid.chorke.org/chain.pem
</syntaxhighlight>
</VirtualHost>
</IfModule>
</source>


'''Artifactory 4.0.0'''
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
docker pull docker.bintray.io/jfrog/artifactory-pro:4.0.0
apachectl -t
docker pull docker.bintray.io/jfrog/artifactory-oss:4.0.0
systemctl reload httpd
systemctl restart httpd
# http://cid.chorke.org/artifactory/webapp/#/login@admin/password
</syntaxhighlight>
</syntaxhighlight>


==How to run==
==To Run==
<syntaxhighlight lang="bash">
<source lang="bash">
docker run --name='artifactory' -d -p 9040:8081 docker.bintray.io/jfrog/artifactory-oss:4.1.0
docker exec -it artifactory bash
docker exec -it artifactory bash
docker start artifactory
docker start artifactory
docker stop artifactory
docker stop artifactory
</syntaxhighlight>
docker logs artifactory
 
</source>
<syntaxhighlight lang="bash">
vim /etc/httpd/conf.modules.d/00-proxy.conf
</syntaxhighlight>
 
<syntaxhighlight lang="cfg">
 
    # proxy for artifactory
    ProxyPass /artifactory http://localhost:8089/artifactory nocanon
    ProxyPassReverse /artifactory http://localhost:8089/artifactory


</syntaxhighlight>
== Debian ==
<source lang="bash">
cat <<EOF >> /etc/apt/sources.list.d/jfrog-artifactory.list
deb https://releases.jfrog.io/artifactory/artifactory-debs buster main
# deb https://releases.jfrog.io/artifactory/artifactory-debs bionic main
# deb https://releases.jfrog.io/artifactory/artifactory-debs xenial main
EOF


<syntaxhighlight lang="bash">
wget -qO - https://releases.jfrog.io/artifactory/api/gpg/key/public|apt-key add -
apachectl -t
apt update;apt list --upgradable;apt search jfrog-artifactory-cpp-ce
service httpd restart
</source>
<source lang="properties">
cat <<EOF >> $JFROG_HOME/artifactory/var/etc/system.yaml
configVersion: 1
shared:
  extraJavaOpts: "-server -Xms512m -Xmx1g -Xss256k -XX:+UseG1GC"
  node:
    primary: true
  database:
    type: postgresql
    driver: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/artifactory
    username: artifactory
    password: password
EOF
</source>


# http://cdn.chorke.org/artifactory/webapp/#/login@admin/password
<source lang="bash">
</syntaxhighlight>
# pios swap memory
printf '\nbefore:\n';free -th;\
sed -i "s|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|" /etc/dphys-swapfile;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th
</source>


== Good to Know ==
==Knowledge==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# filter and remove docker images, containers  
# filter and remove docker images, containers  
Line 81: Line 158:


==References==
==References==
{|
| valign="top" |
* [https://jfrog.com/knowledge-base/how-to-remove-artifactory-from-the-context-url-in-artifactory-7/ Remove artifactory from the Context URL]
* [https://www.jfrog.com/confluence/display/JFROG/Installing+Artifactory#InstallingArtifactory-DockerInstallation Installing Artifactory Docker Installation]
* [https://conan.io/ Conan, the C / C++ Package Manager]
* [https://www.jfrog.com/confluence/display/RTF6X/Configuring+a+Reverse+Proxy Configuring a Reverse Proxy]
* [https://github.com/jfrog/artifactory-docker-examples Artifactory Docker Examples]
----
* [https://docs.docker.com/engine/reference/commandline/volume_create/ Docker volume create]
* [https://www.jfrog.com/confluence/display/RTF/Installing+with+Docker Installing with Docker]
* [https://www.jfrog.com/confluence/display/RTF/Installing+with+Docker Installing with Docker]
* [https://www.jfrog.com/confluence/display/RTF4X/Running+with+Docker Running with Docker]
* [https://www.jfrog.com/confluence/display/RTF4X/Running+with+Docker Running with Docker]
* [https://docs.docker.com/engine/reference/commandline/volume_create/ Docker volume create]
 
* [https://github.com/jfrog/artifactory-docker-examples Artifactory Docker Examples]
| valign="top" |
* [https://bintray.com/jfrog/product/JFrog-Artifactory-Oss/view JFrog Artifactory Community Edition]
 
|}

Latest revision as of 17:43, 30 August 2020

Linux:
export JFROG_HOME=/srv/jfrog
MacOS:
export JFROG_HOME=$HOME/jfrog
Local location Container location Usage
$JFROG_HOME/artifactory7/var/ /var/opt/jfrog/artifactory For storing artifactory data
docker run -it --rm \
--publish 9040:8081 \
--publish 9041:8082 \
docker.bintray.io/jfrog/artifactory-oss:7.6.3 \
bin/bash
id; exit
mkdir -p $JFROG_HOME/artifactory7/var/etc/
touch $JFROG_HOME/artifactory7/var/etc/system.yaml
chown -R 1030:1030 $JFROG_HOME/artifactory7/var

Docker

Debian

docker run --detach \
--publish 9040:8081 \
--publish 9041:8082 \
--name artifactory \
--restart always \
--volume $JFROG_HOME/artifactory7/var/:/var/opt/jfrog/artifactory \
docker.bintray.io/jfrog/artifactory-oss:7.6.3

CentOS

docker run --detach \
--publish 9040:8081 \
--publish 9041:8082 \
--name artifactory \
--restart always \
--volume $JFROG_HOME/artifactory7/var/:/var/opt/jfrog/artifactory:Z \
docker.bintray.io/jfrog/artifactory-oss:7.6.3

Apache

Debian

vim /etc/apache2/sites-enabled/01-cid.chorke.org-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    SSLProxyVerify None
    ProxyPreserveHost On
    AllowEncodedSlashes On
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off
    SSLProxyCheckPeerExpire Off
    # more others config skipped

    <Location /ui>
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:9041/ui nocanon
        ProxyPassReverse http://localhost:9041/ui
    </Location>

    <Location /artifactory>
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:9040/artifactory nocanon
        ProxyPassReverse http://localhost:9040/artifactory
    </Location>

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/cid.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/cid.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/cid.chorke.org/chain.pem
</VirtualHost>
</IfModule>
apachectl -t
systemctl reload httpd
systemctl restart httpd
# http://cid.chorke.org/artifactory/webapp/#/login@admin/password

To Run

docker exec -it artifactory bash
docker start artifactory
docker stop artifactory
docker logs artifactory

Debian

cat <<EOF >> /etc/apt/sources.list.d/jfrog-artifactory.list
deb https://releases.jfrog.io/artifactory/artifactory-debs buster main
# deb https://releases.jfrog.io/artifactory/artifactory-debs bionic main
# deb https://releases.jfrog.io/artifactory/artifactory-debs xenial main
EOF

wget -qO - https://releases.jfrog.io/artifactory/api/gpg/key/public|apt-key add -
apt update;apt list --upgradable;apt search jfrog-artifactory-cpp-ce
cat <<EOF >> $JFROG_HOME/artifactory/var/etc/system.yaml
configVersion: 1
shared:
  extraJavaOpts: "-server -Xms512m -Xmx1g -Xss256k -XX:+UseG1GC"
  node:
    primary: true
  database:
    type: postgresql
    driver: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/artifactory
    username: artifactory
    password: password
EOF
# pios swap memory
printf '\nbefore:\n';free -th;\
sed -i "s|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|" /etc/dphys-swapfile;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th

Knowledge

# filter and remove docker images, containers 
docker rm $(docker ps --all -q -f status=dead)
docker rmi $(docker images -qa -f 'dangling=true')
docker rm artifactory && docker rmi docker.bintray.io/jfrog/artifactory-oss:4.1.0

# docker container debug, checking history & service
docker run --name='artifactory' -it docker.bintray.io/jfrog/artifactory-oss:4.1.0
docker history docker.bintray.io/jfrog/artifactory-oss:4.1.0
docker exec -it artifactory /bin/bash
docker exec -it artifactory bash
docker logs artifactory 
service --status-all

References