Newer
Older
nc-env / templates / template11-minio-storage-server / provision.sh
#!/bin/bash

timedatectl set-timezone Europe/Madrid

start_time=`date`
  
echo "provisioning started: ${start_time}" 

#### The user must fill these variables - START
 
# Fully Qualified Name: ex. "nc.localenv.com"
MACHINE_HOSTNAME=
 
#### The user must fill these variables - END


MINIO_STORAGE_FOLDER=/usr/local/share/minio/

NETWORK_INTERFACE=eth0

hostnamectl set-hostname ${MACHINE_HOSTNAME}

# Print some information about the container OS
hostnamectl

# Print some information about the container timezone
timedatectl

#####################################################################
## Script inspired by https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04
#####################################################################
cp /vagrant/artifacts/minio /usr/local/bin

chmod +x /usr/local/bin/minio

chown ${SYSTEM_USER}:${SYSTEM_USER} /usr/local/bin/minio

mkdir /etc/minio

cp /vagrant/artifacts/minio.conf /etc/minio

sed -i "s|#MACHINE_HOSTNAME#|${MACHINE_HOSTNAME}|g" /etc/minio/minio.conf 

sed -i "s|#MINIO_STORAGE_FOLDER#|${MINIO_STORAGE_FOLDER}|g" /etc/minio/minio.conf 

cp /vagrant/artifacts/minio.service /etc/systemd/system/

mkdir ${MINIO_STORAGE_FOLDER}

export CAROOT=/vagrant/artifacts/

apt install mkcert
 
mkcert -install

mkdir /etc/minio/certs
 
mkcert  --cert-file /etc/minio/certs/public.crt --key-file /etc/minio/certs/private.key "${MACHINE_HOSTNAME}"

systemctl daemon-reload

systemctl enable minio

systemctl start minio

systemctl status minio

end_time=`date`

echo "	You can connect with user admin (password admin123) to te Minio Web Console https://${MACHINE_HOSTNAME}:9000. These are also the connection details to be used in config.php."

echo "provisioning started: ${start_time}" 
 
echo "provisioning ended: ${end_time}"