Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Docker-Compose:

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

services:
 kodi-sql:
    container_name: kodi-sql
    hostname: kodi-sql
    image: mariadb
    ports:
      - '3506:3306'
    volumes:
      - type: bind
        source: /opt/kodisql/sql_data/
        target: /var/lib/mysql
      - type: bind
        source: /opt/kodisql/mnt/
        target: /mnt
    environment:
      - 'TZ=America/Whitehorse'
      - 'MYSQL_ROOT_PASSWORD=kodi'

EOF
chmod +x docker-compose.yaml

...

Docker-Compose:

No Format
WD=/opt/kodi-sqlkodisql/setup
cat << EOF >$WD/kodi-sql.service.setup.sh
cat << EOL >/lib/systemd/system/kodi-sql.service
[Unit]
Description=kodi-sql_Docker
Requires=docker.service network-online.target

[Service]

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

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

...