install.linux.sh 2.93 KB
Newer Older
1 2
#!/bin/bash

3
#Current version of libre.sh to be installed 
Michel Memeteau's avatar
Michel Memeteau committed
4
LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe
5
# System env vars  : can be overrided by a values.env file next to this install file
6 7


8
### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps
Michel Memeteau's avatar
Michel Memeteau committed
9

Michel Memeteau's avatar
Michel Memeteau committed
10
APP_REPO_URL="lab.libreho.st/libre.sh/compose"
Michel Memeteau's avatar
Michel Memeteau committed
11

12 13 14
## domain handling 

### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, )
15 16 17 18 19 20 21
DOMAIN_SERVER=namecheap

###  Namecheap specific
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=

22
### ovh specific (WIP) 
23 24 25 26
OVH_URL="eu.api.ovh.com"
OVH_API_USER=""
OVH_API_KEY=

27 28 29 30 31 32 33

### Scaleway specific (WIP) 
SCALEWAY_URL=""
SCALEWAY_API_USER=""
SCALEWAY_API_KEY=


Michel Memeteau's avatar
Michel Memeteau committed
34
### TODO :  change your settings 
35 36 37 38 39 40 41 42 43 44 45 46
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
Michel Memeteau's avatar
Michel Memeteau committed
47

48
### CONFIG  : Change your mail settings.
49 50 51 52 53 54
## SMTP
MAIL_USER=
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587

Michel Memeteau's avatar
Michel Memeteau committed
55
### TODO : source a setting file is present to override defaults
56

Michel Memeteau's avatar
Michel Memeteau committed
57
echo "-------- Welcome to libre.sh $LIBRE_VERSION installer"
Michel Memeteau's avatar
Michel Memeteau committed
58

59 60 61 62
echo "----  sourcing local values.env file if present"

source values.env

63

Michel Memeteau's avatar
Michel Memeteau committed
64
# STEP add kernel parameter
65

Michel Memeteau's avatar
Michel Memeteau committed
66 67
# STEP Define environnement

Michel Memeteau's avatar
Michel Memeteau committed
68 69
echo "-------- setting up system variables"

Michel Memeteau's avatar
Michel Memeteau committed
70
echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
71

Michel Memeteau's avatar
Michel Memeteau committed
72
echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
73

Michel Memeteau's avatar
Michel Memeteau committed
74
echo "MAIL_USER=${MAIL_USER}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
75

Michel Memeteau's avatar
Michel Memeteau committed
76
echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
77

Michel Memeteau's avatar
Michel Memeteau committed
78
echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
79

Michel Memeteau's avatar
Michel Memeteau committed
80
echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment
Michel Memeteau's avatar
Michel Memeteau committed
81

Michel Memeteau's avatar
Michel Memeteau committed
82 83 84 85 86 87 88 89 90

# 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 
Michel Memeteau's avatar
Michel Memeteau committed
91

92

Michel Memeteau's avatar
Michel Memeteau committed
93
# STEP "install docker-compose" 
Michel Memeteau's avatar
Michel Memeteau committed
94 95
echo "-------- Install latest docker-compose "

Michel Memeteau's avatar
Michel Memeteau committed
96 97 98 99 100 101
# 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
Michel Memeteau's avatar
Michel Memeteau committed
102 103 104 105



# STEP install Libre.sh
106

Michel Memeteau's avatar
Michel Memeteau committed
107
echo "-------- installing libre.sh" 
Michel Memeteau's avatar
Michel Memeteau committed
108

109
git clone https://lab.libreho.st/libre.sh/compose.libre.sh -b $LIBRE_VERSION /libre.sh 
110
mkdir -p /{data,system}
Michel Memeteau's avatar
Michel Memeteau committed
111
mkdir -p /data/trash 
112 113 114 115 116 117 118
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/


Michel Memeteau's avatar
Michel Memeteau committed
119
# STEP add /opt/bin path
120 121


Michel Memeteau's avatar
Michel Memeteau committed
122
echo "-------- updating PATH" 
123 124 125
cat > /etc/profile.d/libre.sh <<EOF
export PATH=$PATH:/opt/bin
EOF
Michel Memeteau's avatar
Michel Memeteau committed
126
chmod 644 /etc/profile.d/libre.sh
Michel Memeteau's avatar
Michel Memeteau committed
127 128
bash /etc/profile.d/libre.sh