Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Docker-Compose:

cat << 'EOF' >docker-compose.yaml
version: '3.2'

services:

  sitenamedb:
    container_name: sitenamedb
    hostname: sitenamedb
    image: mariadb
    restart: always
    networks:
      - sitenamenet
    environment:
      - 'MYSQL_ROOT_PASSWORD=${DB_PWD}'
      - 'MYSQL_DATABASE=${DB_NAME}'
      - 'MYSQL_USER=${DB_USER}'
      - 'MYSQL_PASSWORD=${DB_PWD}'
    volumes:
      - type: bind
        source: /opt/wordpress/wordpress_sql/
        target: /var/lib/mysql
      - type: bind
        source: /opt/wordpress/mnt/
        target: /mnt

  sitename:
    depends_on:
      - sitenamedb
    container_name: sitename
    hostname: sitename
    image: wordpress
    restart: always
    networks:
      - sitenamenet
    ports:
      - 8575:80
    environment:
      - WORDPRESS_DB_HOST=sitenamedb:3306
      - WORDPRESS_DB_USER=${DB_USER}
      - WORDPRESS_DB_PASSWORD=${DB_PWD}
      - WORDPRESS_DB_NAME=${DB_NAME}
      - 'TZ=America/Whitehorse'
    volumes:
      - type: bind
        source: /opt/sitename/html/
        target: /var/www/html
      - type: bind
        source: /opt/sitename/mnt/
        target: /mnt
      - type: bind
        source: /opt/sitename/setup/uploads.ini 
        target: /usr/local/etc/php/conf.d/uploads.ini

networks:
  sitenamenet:
    driver: bridge

EOF
chmod +x docker-compose.yaml
docker-compose up
WD=/opt/ytit
cd $WD/setup
cat << 'EOF' >uploads.ini
file_uploads = On
memory_limit = 512M
upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 600
EOF
WD=/opt/sitename
cd $WD/setup
cat << 'EOF'>.env
DB_NAME=sitename
DB_USER=UNAME
DB_PWD=PWD
EOF
chmod +x .env


SystemD Integration:

Docker-Compose:

Note: no "-d"

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

[Service]

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

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

CLI Access:

Add to XYMon:

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

NGinX:

##NAME
server {
       listen         80;
       server_name    sub.domain.tld;

       return         301 https://$server_name/;

}

server {
        listen 443 ssl;
        server_name sub.domain.tld;

location / {

        proxy_pass              https://localhost:8575/;
        include                 /etc/nginx/proxy.conf;
    }
}



  • No labels