Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Docker Run:

WD=/opt/container
mkdir -p $WD/{mnt,setup,...}
cd $WD/setup
cat << 'EOF' >container_docker.sh
#!/bin/bash

EOF
chmod +x container_docker.sh
./container_docker.sh

Docker-Compose:

WD=/opt/dcontainer
mkdir -p $WD/{mnt,setup,conf}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.7'

services:
 dcontainer:
    container_name: dcontainer
    image: dcontainer
    hostname: dcontainer
    ports:
      - '6565:80'
    volumes:
      - type: bind
        source: /opt/dcontainer/conf/
        target: /etc/dcontainer
      - type: bind
        source: /opt/dcontainer/mnt/
        target: /mnt

    environment:
      - 'TZ=America/Whitehorse'
#      - 'MYSQL_ROOT_PASSWORD=${DB_PWD}'
#      - 'MYSQL_DATABASE=${DB_NAME}'
#      - 'MYSQL_USER=${DB_USER}'
#      - 'MYSQL_PASSWORD=${DB_PWD}'

EOF
chmod +x docker-compose.yaml


SystemD Integration:

Docker Run:

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

[Service]
Restart=on-abnormal
ExecStart=/usr/bin/docker start -a container
ExecStop=/usr/bin/docker stop -t 2 container

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

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 restart dcontainer
systemctl status dcontainer
EOF
chmod +x $WD/dcontainer.service.setup.sh
$WD/dcontainer.service.setup.sh
cd $WD/setup
cat << 'EOF'>.env
CONF_VER=7.3.3
DB_NAME=
DB_USER=
DB_PWD=
#DB_TYPE=postgresql
#DB_PORT=5432 
DB_TYPE=mariadb
DB_PORT=3306
PROXY_NAME=freesoftwareservers.com
PROXY_PORT=443
SCHEME=https
SECURE=true
EOF
chmod +x .env


CLI Access:

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

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:8443/;
        include                 /etc/nginx/proxy.conf;
    }
}



  • No labels