docker配備confluence

14935 ワード

アプリケーションコンテナ化の導入はすでに標準化されたプロセスであるため、具体的な導入プロセスを詳細に説明する必要はありません.したがって、この文書では、関連する構成ドキュメントのみを提供します.配置プロセスを知らない学生は、まず容器の基礎を独学してください.ミラーは次のように作成されました.
docker.io/xhuaustc/confluence:6.7.1
docker.io/xhuaustc/atlassian-mysql:5.7

ミラー構築構成
mysqlミラー
# my.cnf
[mysqld]

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0

# http://www.percona.com/blog/2008/05/31/dns-achilles-heel-mysql-installation/
skip_name_resolve

# http://www.chriscalender.com/ignoring-the-lostfound-directory-in-your-datadir/
ignore-db-dir=lost+found

character_set_server=utf8
init_connect='SET NAMES utf8'
collation_server=utf8_bin
transaction_isolation='read-committed'

!includedir /etc/my.cnf.d

# Dockerfile
FROM centos/mysql-57-centos7
COPY my.cnf /etc/my.cnf

confluenceミラー
git clone https://github.com/cptactionhank/docker-atlassian-confluence

Dockerfileディレクトリにserverを追加します.xml, setenv.shとatlassian-extras-decoder-v 2-3.3.0.jar
# server.xml


  
    
    
      
        
          
          
          
        
        
          
        
      
    
    
    
  

# setenv.sh
# See the CATALINA_OPTS below for tuning the JVM arguments used to start Confluence.

echo "If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide"

# set the location of the pid file
if [ -z "$CATALINA_PID" ] ; then
    if [ -n "$CATALINA_BASE" ] ; then
        CATALINA_PID="$CATALINA_BASE"/work/catalina.pid
    elif [ -n "$CATALINA_HOME" ] ; then
        CATALINA_PID="$CATALINA_HOME"/work/catalina.pid
    fi
fi
export CATALINA_PID

PRGDIR=`dirname "$0"`
if [ -z "$CATALINA_BASE" ]; then
  if [ -z "$CATALINA_HOME" ]; then
    LOGBASE=$PRGDIR
    LOGTAIL=..
  else
    LOGBASE=$CATALINA_HOME
    LOGTAIL=.
  fi
else
  LOGBASE=$CATALINA_BASE
  LOGTAIL=.
fi

PUSHED_DIR=`pwd`
cd $LOGBASE
cd $LOGTAIL
LOGBASEABS=`pwd`
cd $PUSHED_DIR

echo ""
echo "Server startup logs are located in $LOGBASEABS/logs/catalina.out"
# IMPORTANT NOTE: Only set JAVA_HOME or JRE_HOME above this line
# Get standard Java environment variables
if $os400; then
  # -r will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  . "$CATALINA_HOME"/bin/setjre.sh
else
  if [ -r "$CATALINA_HOME"/bin/setjre.sh ]; then
    . "$CATALINA_HOME"/bin/setjre.sh
  else
    echo "Cannot find $CATALINA_HOME/bin/setjre.sh"
    echo "This file is needed to run this program"
    exit 1
  fi
fi

echo "---------------------------------------------------------------------------"
echo "Using Java: $JRE_HOME/bin/java"
CONFLUENCE_CONTEXT_PATH=`$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/confluence-context-path-extractor.jar $CATALINA_HOME`
export CONFLUENCE_CONTEXT_PATH
$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/synchrony-proxy-watchdog.jar $CATALINA_HOME
echo "---------------------------------------------------------------------------"
JVM_MINIMUM_MEMORY=${JVM_XMS:-384m}
JVM_MAXIMUM_MEMORY=${JVM_XMX:-768m}

# Set the JVM arguments used to start Confluence. For a description of the options, see
# http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
CATALINA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} -XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}"
CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}"
CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}"
CATALINA_OPTS="-Dsynchrony.enable.xhr.fallback=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 ${CATALINA_OPTS}"
CATALINA_OPTS="${START_CONFLUENCE_JAVA_OPTS} ${CATALINA_OPTS}"
CATALINA_OPTS="-Dconfluence.context.path=${CONFLUENCE_CONTEXT_PATH} ${CATALINA_OPTS}"


export CATALINA_OPTS


Dockerfileの変更
# Dockerfile
FROM openjdk:8-alpine

# Setup useful environment variables
ENV CONF_HOME     /var/atlassian/confluence
ENV CONF_INSTALL  /opt/atlassian/confluence
ENV CONF_VERSION  6.7.1

ENV JAVA_CACERTS  $JAVA_HOME/jre/lib/security/cacerts
ENV CERTIFICATE   $CONF_HOME/certificate

# Install Atlassian Confluence and helper tools and setup initial home
# directory structure.
RUN set -x \
    && apk --no-cache add curl xmlstarlet bash ttf-dejavu libc6-compat \
    && mkdir -p                "${CONF_HOME}" \
    && chmod -R 777            "${CONF_HOME}" \
    && mkdir -p                "${CONF_INSTALL}/conf" \
    && curl -Ls                "https://www.atlassian.com/software/confluence/downloads/binary/atlassian-confluence-${CONF_VERSION}.tar.gz" | tar -xz --directory "${CONF_INSTALL}" --strip-components=1 --no-same-owner \
    && curl -Ls                "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.44.tar.gz" | tar -xz --directory "${CONF_INSTALL}/confluence/WEB-INF/lib" --strip-components=1 --no-same-owner "mysql-connector-java-5.1.44/mysql-connector-java-5.1.44-bin.jar" \
    && chmod -R 777            "${CONF_INSTALL}/conf" \
    && chmod -R 777            "${CONF_INSTALL}/temp" \
    && chmod -R 777            "${CONF_INSTALL}/logs" \
    && chmod -R 777            "${CONF_INSTALL}/work" \
    && echo -e                 "
confluence.home=$CONF_HOME" >> "${CONF_INSTALL}/confluence/WEB-INF/classes/confluence-init.properties" \ && xmlstarlet ed --inplace \ --delete "Server/@debug" \ --delete "Server/Service/Connector/@debug" \ --delete "Server/Service/Connector/@useURIValidationHack" \ --delete "Server/Service/Connector/@minProcessors" \ --delete "Server/Service/Connector/@maxProcessors" \ --delete "Server/Service/Engine/@debug" \ --delete "Server/Service/Engine/Host/@debug" \ --delete "Server/Service/Engine/Host/Context/@debug" \ "${CONF_INSTALL}/conf/server.xml" \ && touch -d "@0" "${CONF_INSTALL}/conf/server.xml" # Use the default unprivileged account. This could be considered bad practice # on systems where multiple processes end up being executed by 'daemon' but # here we only ever run one process anyway. # Expose default HTTP connector port. EXPOSE 8090 8091 # Set volume mount points for installation and home directory. Changes to the # home directory needs to be persisted as well as parts of the installation # directory due to eg. logs. VOLUME ["/var/atlassian/confluence", "/opt/atlassian/confluence/logs"] # Set the default working directory as the Confluence home directory. WORKDIR /var/atlassian/confluence COPY docker-entrypoint.sh / COPY atlassian-extras-decoder-v2-3.3.0.jar /opt/atlassian/confluence/confluence/WEB-INF/lib/atlassian-extras-decoder-v2-3.3.0.jar COPY server.xml /opt/atlassian/confluence/conf/server.xml ENTRYPOINT ["/docker-entrypoint.sh"] # Run Atlassian Confluence as a foreground process by default. CMD ["/opt/atlassian/confluence/bin/start-confluence.sh", "-fg"]

docker-compose構成
mysqlはmysqlユーザーで起動するのでdata/mysql権限を777 chmod 777 data/mysql -Rに変更する必要があります
wiki:
  image: xhuaustc/confluence:6.7.1
  restart: always
  environment:
    - JVM_XMX=1024m
    - JVM_XMS=512m
  ports:
    - '10380:8090'
  links:
    - db
  volumes:
    - ./data/confluence:/var/atlassian/confluence
    - ./data/logs:/opt/atlassian/confluence/logs

db:
  image: xhuaustc/atlassian-mysql:5.7
  restart: always
  environment:
    - MYSQL_USER=confluence
    - MYSQL_PASSWORD=conflence
    - MYSQL_DATABASE=confluence
    - MYSQL_ROOT_PASSWORD=confluence
  volumes:
    - ./data/mysql:/var/lib/mysql

Openshfit confluenceテンプレート
apiVersion: v1
kind: Template
metadata:
  creationTimestamp: null
  name: confluence
objects:
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    labels:
      run: confluence
    name: confluence
  spec:
    replicas: 1
    selector:
      run: confluence
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          run: confluence
      spec:
        containers:
        - env:
            - name: JVM_XMX
              value: '2048m'
            - name: JVM_XMS
              value: '1024m'
          image: docker.io/xhuaustc/confluence:6.7.1
          imagePullPolicy: IfNotPresent
          name: confluence
          volumeMounts:
          - mountPath: /var/atlassian/confluence
            name: volume-7iy6x
          - mountPath: /opt/atlassian/confluence/logs
            name: volume-zsyly
        volumes:
        - name: volume-7iy6x
          persistentVolumeClaim:
            claimName: confluence
        - name: volume-zsyly
          persistentVolumeClaim:
            claimName: log
    triggers:
    - type: ConfigChange
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    labels:
      run: mysql
    name: mysql
  spec:
    replicas: 1
    selector:
      run: mysql
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          run: mysql
      spec:
        containers:
        - env:
          - name: MYSQL_USER
            value: confluence
          - name: MYSQL_PASSWORD
            value: confluence
          - name: MYSQL_DATABASE
            value: confluence
          - name: MYSQL_ROOT_PASSWORD
            value: confluence
          image: docker.io/xhuaustc/atlassian-mysql:5.7
          imagePullPolicy: IfNotPresent
          name: mysql
          volumeMounts:
          - mountPath: /var/lib/mysql
            name: volume-uiwfa
         volumes:
          - name: volume-uiwfa
            persistentVolumeClaim:
              claimName: mysql-data
    triggers:
    - type: ConfigChange
- apiVersion: v1
  kind: Service
  metadata:
    labels:
      run: confluence
    name: confluence
  spec:
    ports:
    - port: 8090
      protocol: TCP
      targetPort: 8090
    selector:
      run: confluence
    type: ClusterIP
- apiVersion: v1
  kind: Service
  metadata:
    labels:
      run: mysql
    name: mysql
  spec:
    ports:
    - port: 3306
      protocol: TCP
      targetPort: 3306
    selector:
      run: mysql
    type: ClusterIP
- apiVersion: v1
  kind: Route
  metadata:
    annotations:
      haproxy.router.openshift.io/timeout: 3000s
    labels:
      run: confluence
    name: confluence
  spec:
    port:
      targetPort: 8090
    to:
      kind: Service
      name: confluence
      weight: 100
    wildcardPolicy: None
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      volume.beta.kubernetes.io/storage-class: ceph-rbd-sc
      volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/rbd
    name: confluence
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 20Gi
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      volume.beta.kubernetes.io/storage-class: ceph-rbd-sc
      volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/rbd
    name: log
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 10Gi
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      volume.beta.kubernetes.io/storage-class: ceph-rbd-sc
      volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/rbd
    name: mysql-data
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 10Gi

作者:潘暁華Michaelリンク:https://www.jianshu.com/p/e1e8b29affc0出典:簡書簡書の著作権は著者の所有であり、いかなる形式の転載も著者に連絡して授権を得て出典を明記してください.