Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
rm /opt/confluence/confluence_data -R
rm /opt/confluence/pg_data -R
systemctl stop confluence
cd $WD/setup
docker-compose up

https://hub.docker.com/r/atlassian/confluence-server/

WD=/opt/confluence
mkdir -p $WD/{confluence_sql,confluence_data,mnt,setup}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.2'

services:
  confluence:
    image: atlassian/confluence-server:${CONF_VER}
    container_name: confluence
    hostname: confluence
    networks:
      - confluencenet
    volumes:
      - type: bind
        source: /opt/confluence/confluence_data/
        target: /var/atlassian/application-data/confluence
      - type: bind
        source: /opt/confluence/mnt/
        target: /mnt
    ports:
      - '8090:8090'
      - '8091:8091'
    environment:
#      - 'CATALINA_OPTS= -Xms256m -Xmx1g -Datlassian.recovery.password=password'
      - 'CATALINA_OPTS= -Xms256m -Xmx1g'
      - 'ATL_PROXY_NAME=${PROXY_NAME}'
      - 'ATL_PROXY_PORT=${PROXY_PORT}'
      - 'ATL_TOMCAT_SCHEME=${SCHEME}'
      - 'ATL_TOMCAT_SECURE=${SECURE}'
      - 'ATL_JDBC_URL=jdbc:${DB_TYPE}://confluence_sql:${DB_PORT}/${DB_NAME}'
      - 'ATL_JDBC_USER=${DB_USER}'
      - 'ATL_JDBC_PASSWORD=${DB_PWD}'
      - 'ATL_DB_TYPE=${DB_TYPE}'

  confdb:
    container_name: confluence_sql
    hostname: confluence_sql
    networks:
      - confluencenet

      
    image: postgres
    ports:
      - '6565:5432'
    volumes:
      - type: bind
        source: /opt/confluence/confluence_sql/
        target: /var/lib/postgresql/data
      - type: bind
        source: /opt/confluence/mnt/
        target: /mnt
    environment:
      - 'POSTGRES_USER=${DB_USER}'
      - 'POSTGRES_PASSWORD=${DB_PWD}'
      - 'POSTGRES_DB=${DB_NAME}'
      - 'POSTGRES_ENCODING=UTF8'
      - 'POSTGRES_COLLATE=C'
      - 'POSTGRES_COLLATE_TYPE=C'

#Use Postgres!~      
#    image: mysql:5.7
#    ports:
#      - '6565:3306'
#     volumes:
#      - type: bind
#        source: /opt/confluence/confluence_sql/
#        target: /var/lib/mysql
#      - type: bind
#        source: /opt/confluence/mnt/
#        target: /mnt
#    environment:
#      - 'MYSQL_ROOT_PASSWORD=${DB_PWD}'
#      - 'MYSQL_DATABASE=${DB_NAME}'
#      - 'MYSQL_USER=${DB_USER}'
#      - 'MYSQL_PASSWORD=${DB_PWD}'
#    command: [mysqld, --character-set-server=utf8, --collation-server=utf8_bin, --default-storage-engi$

networks:
  confluencenet:
    driver: bridge
EOF
chmod +x docker-compose.yaml

Note: Use PostgreSQL if at all possible, if using MySQL you have to cp in the JDBC connector, and restart the docker-compose.

docker cp /opt/confluence/setup/mysql-connector-java*jar confluence:/opt/atlassian/confluence/confluence/WEB-INF/lib

Variables:

cd $WD/setup
cat << 'EOF'>.env
CONF_VER=7.3.3
DB_NAME=confluence
DB_USER=confluence
DB_PWD=confluence
DB_TYPE=postgresql
DB_PORT=5432 
#DB_TYPE=mysql
#DB_PORT=3306
PROXY_NAME=freesoftwareservers.com
PROXY_PORT=443
SCHEME=https
SECURE=true
EOF
chmod +x .env
cd $WD/setup
docker-compose up # -d to run in background, but test without -d for verbosity

SystemD Integration: 

WD=/opt/confluence/setup
cat << EOF >$WD/confluence.service.setup.sh
cat << EOL >/lib/systemd/system/confluence.service
[Unit]
Description=Docker_Description
Requires=docker.service network-online.target

[Service]

Restart=on-abnormal
ExecStart=/usr/bin/docker-compose --project-name confluence --project-directory $WD -f $WD/docker-compose.yaml up
ExecStop=/usr/bin/docker-compose --project-name confluence --project-directory $WD -f $WD/docker-compose.yaml stop

[Install]
WantedBy=multi-user.target
EOL
systemctl enable confluence
systemctl start confluence
EOF
chmod +x $WD/confluence.service.setup.sh
$WD/confluence.service.setup.sh

CLI Access:

echo 'alias confluencecli="docker exec -it confluence /bin/bash"' >> ~/.bashrc
source ~/.bashrc

Add to XYMon:

nano /etc/xymon/analysis.cfg && systemctl restart xymon xymon-client
        PROC confluence

NGinX:

##NAME
server {
       listen         80;
       server_name    freesoftwareservers.com;

       return         301 https://$server_name/;

}

server {
        listen 443 ssl;
        server_name freesoftwareservers.com;

location / {

        proxy_pass              http://localhost:8090/;
        include                 /etc/nginx/proxy.conf;
    }
}

  • No labels