`
sillycat
  • 浏览: 2564592 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Jfrog Artifactory 2019 Cluster in Ubuntu

 
阅读更多
Jfrog Artifactory 2019 Cluster in Ubuntu


I go to the page and download the file
https://jfrog.com/open-source/#artifactory
The file I download is jfrog-artifactory-oss-6.8.4.zip
Unzip the file and place in working directory.
Change the bin/artifactory.default as follow:
> cat bin/artifactory.default
#!/bin/sh
#Default values
export ARTIFACTORY_HOME=/opt/artifactory
export ARTIFACTORY_USER=carl
export JAVA_HOME=/opt/jdk
#export START_LOCAL_REPLICATOR=true
#export START_LOCAL_MDS=true
export TOMCAT_HOME=$ARTIFACTORY_HOME/tomcat
export ARTIFACTORY_PID=$ARTIFACTORY_HOME/run/artifactory.pid
export JAVA_OPTIONS="-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\"kill -9 %p\""
export JAVA_OPTIONS="$JAVA_OPTIONS -Djruby.bytecode.version=1.8 -Djruby.compile.invokedynamic=false -Dfile.encoding=UTF8 -Dartdist=zip -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djava.security.egd=file:/dev/./urandom"
# Timeout waiting for artifactory to start
# START_TMO=60
Command to start
> bin/artifactory.sh start
It is working now. Then I will build the Docker manually.
Here is the Dockerfile I use
#Run an artifactory
#Prepare the OS
FROM            ubuntu:16.04
MAINTAINER      Rachel Kang <yiyikangrachel@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME       /usr/lib/jvm/java-8-oracle
ENV LANG            en_US.UTF-8
ENV LC_ALL          en_US.UTF-8
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
#Prepare the denpendencies
RUN apt-get install -qy wget unzip vim
RUN apt-get install -qy iputils-ping
#Install SUN JAVA
RUN apt-get update && \
  apt-get install -y --no-install-recommends locales && \
  locale-gen en_US.UTF-8 && \
  apt-get dist-upgrade -y && \
  apt-get --purge remove openjdk* && \
  echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
  echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
  apt-get update && \
  apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
  apt-get clean all
#add the software artifactory
ADD  install/jfrog-artifactory-oss-6.8.4.zip /tool/
WORKDIR /tool/
RUN  unzip jfrog-artifactory-oss-6.8.4.zip
RUN  rm -fr jfrog-artifactory-oss-6.8.4.zip
RUN  ln -s /tool/artifactory-oss-6.8.4 /tool/artifactory
ADD  conf/artifactory.default /tool/artifactory/bin/
ADD  conf/binarystore.xml /tool/artifactory/etc/
#set up the app
EXPOSE  8081
RUN     mkdir -p /app/
ADD     start.sh /app/
WORKDIR /app/
CMD [ "./start.sh" ]
Makefile to support the start/stop Commands
PORT=8081
IMAGE=sillycat/public
TAG=ubuntu-artifactory-1.0
NAME=ubuntu-artifactory-1.0-$(PORT)
   
docker-context:
build: docker-context
    docker build -t $(IMAGE):$(TAG) .
run:
    docker run \
    -d \
    -u root \
    -p $(PORT):8081 \
    -v $(shell pwd)/artifactory-data:/var/opt/jfrog/artifactory \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --name $(NAME) \
    $(IMAGE):$(TAG)
debug:
    docker run -ti -p $(PORT):8081 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
    docker stop ${NAME}
    docker rm ${NAME}
logs:
    docker logs ${NAME}
publish:
    docker push ${IMAGE}
Here is the start.sh Command
#!/bin/sh -ex

#start the service
cd /tool/artifactory
bin/artifactory.sh start
touch /tool/artifactory/logs/artifactory.log
tail -f /tool/artifactory/logs/artifactory.log
Here is the Configure File conf/artifactory.default

#!/bin/sh
#Default values
export ARTIFACTORY_HOME=/tool/artifactory
export ARTIFACTORY_USER=root
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
#export START_LOCAL_REPLICATOR=true
#export START_LOCAL_MDS=true
export TOMCAT_HOME=$ARTIFACTORY_HOME/tomcat
export ARTIFACTORY_PID=$ARTIFACTORY_HOME/run/artifactory.pid
export JAVA_OPTIONS="-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\"kill -9 %p\""
export JAVA_OPTIONS="$JAVA_OPTIONS -Djruby.bytecode.version=1.8 -Djruby.compile.invokedynamic=false -Dfile.encoding=UTF8 -Dartdist=zip -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djava.security.egd=file:/dev/./urandom"
# Timeout waiting for artifactory to start
# START_TMO=60
Here is the configuration file conf/binarystore.xml
<?xml version="1.0" encoding="UTF-8"?>
<config version="1">
    <chain template="file-system" />
    <provider id="file-system" type="file-system">
      <fileStoreDir>/tool/artifactory/m2</fileStoreDir>
    </provider>
</config>
Check status code
> curl -s -o /dev/null -w "%{http_code}" http://localhost:49100/
Health check URL
> curl -s -o /dev/null -w "%{http_code}" http://localhost:49100/artifactory/api/system/ping
200

References:
https://sillycat.iteye.com/blog/2437346
https://sillycat.iteye.com/blog/2431253
https://www.jfrog.com/confluence/display/RTF5X/Installing+with+Docker
https://www.jfrog.com/confluence/pages/viewpage.action?pageId=59082305
https://www.jfrog.com/confluence/display/RTF4X/Configuring+the+Filestore

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics