packer-builds

Packer Builds for LXC and Libvirt
git clone https://git.in0rdr.ch/packer-builds.git
Log | Files | Refs | Pull requests |Archive | README

minio.sh (2043B)


      1 #!/usr/bin/env bash
      2 
      3 set -o errexit
      4 set -o nounset
      5 set -o xtrace
      6 
      7 # Install minio server
      8 # https://min.io/docs/minio/linux/operations/install-deploy-manage/deploy-minio-single-node-single-drive.html
      9 
     10 # Prepare data dir and binary
     11 mkdir -p $MINIO_VOLUMES
     12 chmod +x /usr/local/bin/minio
     13 
     14 # Configure minio user
     15 groupadd -r $MINIO_SERVICE_USER
     16 useradd -M -r -g $MINIO_SERVICE_GROUP $MINIO_SERVICE_USER
     17 chown $MINIO_SERVICE_USER:$MINIO_SERVICE_GROUP $MINIO_VOLUMES
     18 
     19 # Configure minio server
     20 cat << EOF > /etc/default/minio
     21 # MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
     22 # This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
     23 # Omit to use the default values 'minioadmin:minioadmin'.
     24 # MinIO recommends setting non-default values as a best practice, regardless of environment
     25 
     26 MINIO_ROOT_USER=$MINIO_ROOT_USER
     27 MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD
     28 
     29 # MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.
     30 
     31 MINIO_VOLUMES=$MINIO_VOLUMES
     32 
     33 # MINIO_OPTS sets any additional commandline options to pass to the MinIO server.
     34 # For example, `--console-address :9001` sets the MinIO Console listen port
     35 MINIO_OPTS=$MINIO_OPTS
     36 EOF
     37 
     38 # Prepare minio systemd configuration
     39 cat <<EOF > /etc/systemd/system/minio.service
     40 [Unit]
     41 Description=MinIO
     42 Documentation=https://min.io/docs/minio/linux/index.html
     43 Wants=network-online.target
     44 After=network-online.target
     45 AssertFileIsExecutable=/usr/local/bin/minio
     46 
     47 [Service]
     48 WorkingDirectory=/usr/local
     49 User=$MINIO_SERVICE_USER
     50 Group=$MINIO_SERVICE_GROUP
     51 ProtectProc=invisible
     52 EnvironmentFile=-/etc/default/minio
     53 ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
     54 ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
     55 Type=notify
     56 Restart=always
     57 LimitNOFILE=65536
     58 TasksMax=infinity
     59 TimeoutStopSec=infinity
     60 SendSIGKILL=no
     61 
     62 [Install]
     63 WantedBy=multi-user.target
     64 EOF
     65 
     66 systemctl enable minio.service