compose-website/install.linux.sh

135 lines
3 KiB
Bash
Raw Permalink Normal View History

2019-06-24 15:35:56 +00:00
#!/bin/bash
2020-02-26 08:40:36 +00:00
#Current version of libre.sh to be installed
2020-04-03 14:27:02 +00:00
LIBRE_VERSION=release/1.2
2020-03-25 16:10:53 +00:00
# System env vars : can be overrided by a values.env file next to this install file
2019-06-24 15:52:02 +00:00
2020-03-25 16:10:53 +00:00
### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps
2020-02-20 17:00:50 +00:00
2020-03-22 17:35:44 +00:00
APP_REPO_URL="lab.libreho.st/libre.sh/compose"
2020-02-20 17:00:50 +00:00
2020-03-25 16:10:53 +00:00
## domain handling
### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, )
2019-06-24 15:52:02 +00:00
DOMAIN_SERVER=namecheap
### Namecheap specific
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=
2020-03-25 16:10:53 +00:00
### ovh specific (WIP)
2019-06-24 15:52:02 +00:00
OVH_URL="eu.api.ovh.com"
OVH_API_USER=""
OVH_API_KEY=
2020-03-25 16:10:53 +00:00
### Scaleway specific (WIP)
SCALEWAY_URL=""
SCALEWAY_API_USER=""
SCALEWAY_API_KEY=
2020-03-22 17:10:38 +00:00
### TODO : change your settings
2019-06-24 15:52:02 +00:00
IP="curl -s http://icanhazip.com/"
FirstName="Pierre"
LastName="Ozoux"
Address=""
PostalCode=""
Country="Portugal"
Phone="+351.967184553"
EmailAddress="pierre@ozoux.net"
City="Lisbon"
CountryCode="PT"
## Backup
BACKUP_DESTINATION=root@xxxxx:port
2020-03-22 17:10:38 +00:00
2020-03-25 16:10:53 +00:00
### CONFIG : Change your mail settings.
2019-06-24 15:52:02 +00:00
## SMTP
MAIL_USER=
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587
# Default admin emails for apps
ADMIN_EMAIL=support@ekimia.fr
2020-03-22 17:10:38 +00:00
### TODO : source a setting file is present to override defaults
2019-06-24 15:52:02 +00:00
2020-02-26 14:55:14 +00:00
echo "-------- Welcome to libre.sh $LIBRE_VERSION installer"
2020-02-20 17:00:50 +00:00
2020-03-25 16:10:53 +00:00
echo "---- sourcing local values.env file if present"
source values.env
2019-06-24 15:52:02 +00:00
2020-01-10 13:37:39 +00:00
# STEP add kernel parameter
2019-06-24 15:52:02 +00:00
2020-02-20 17:00:50 +00:00
# STEP Define environnement
2020-02-26 14:55:14 +00:00
echo "-------- setting up system variables"
2020-03-22 17:35:44 +00:00
echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment
2020-03-22 17:10:38 +00:00
2020-03-22 17:35:44 +00:00
echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment
2020-03-22 17:10:38 +00:00
2020-03-22 17:35:44 +00:00
echo "MAIL_USER=${MAIL_USER}" >> /etc/environment
2020-03-22 17:10:38 +00:00
2020-03-22 17:35:44 +00:00
echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment
2020-03-22 17:10:38 +00:00
2020-03-22 17:35:44 +00:00
echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment
2020-03-22 17:10:38 +00:00
2020-03-22 17:35:44 +00:00
echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment
2020-03-22 17:10:38 +00:00
echo "ADMIN_EMAIL=${ADMIN_EMAIL}" >> /etc/environment
2020-02-26 14:55:14 +00:00
# STEP Install Docker
echo "-------- Install latest docker "
# TODO : Fix a version for docker ?
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
2020-02-20 17:00:50 +00:00
2019-06-24 15:52:02 +00:00
2020-01-10 13:37:39 +00:00
# STEP "install docker-compose"
2020-02-26 14:55:14 +00:00
echo "-------- Install latest docker-compose "
2020-02-20 17:00:50 +00:00
# TODO : Fix a version for docker compose ?
mkdir -p /opt/bin &&\
dockerComposeVersion=$(curl -s https://api.github.com/repos/docker/compose/releases/latest|grep tag_name|cut -d'"' -f4) &&\
curl -L https://github.com/docker/compose/releases/download/$dockerComposeVersion/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose &&\
chmod +x /opt/bin/docker-compose
2020-01-10 13:37:39 +00:00
# STEP install Libre.sh
2019-06-24 15:52:02 +00:00
2020-02-26 14:55:14 +00:00
echo "-------- installing libre.sh"
2020-02-20 17:00:50 +00:00
git clone https://lab.libreho.st/libre.sh/compose.libre.sh -b $LIBRE_VERSION /libre.sh
2019-06-24 15:52:02 +00:00
mkdir -p /{data,system}
2020-02-26 14:55:14 +00:00
mkdir -p /data/trash
2019-06-24 15:52:02 +00:00
cp /libre.sh/unit-files/* /etc/systemd/system && systemctl daemon-reload
systemctl enable web-net.service
systemctl start web-net.service
mkdir -p /opt/bin
cp /libre.sh/utils/* /opt/bin/
2020-01-10 13:37:39 +00:00
# STEP add /opt/bin path
2019-06-24 15:52:02 +00:00
2020-02-26 14:55:14 +00:00
echo "-------- updating PATH"
2019-06-24 15:52:02 +00:00
cat > /etc/profile.d/libre.sh <<EOF
export PATH=$PATH:/opt/bin
EOF
2020-02-20 17:00:50 +00:00
chmod 644 /etc/profile.d/libre.sh
2020-03-22 17:35:44 +00:00
bash /etc/profile.d/libre.sh