Proper installation instructions

This commit is contained in:
pierreozoux 2016-02-11 11:19:49 +00:00
parent ce544a933c
commit dbcef5c428
2 changed files with 127 additions and 119 deletions

127
INSTALL.md Normal file
View file

@ -0,0 +1,127 @@
# Instructions to install LibrePaaS
## Requirements
- API key on Namecheap
## Recommendation
- ssd on /dev/sda
- hdd on /dev/sdb
- hdd on /dev/sdc
# Installation
Replace the following variables with yours:
IP
hostname
```
ssh -o "StrictHostKeyChecking no" root@$IP
fdisk -l #find your ssd
# Setup raid
cat > /etc/mdadm.conf << EOF
MAILADDR dev@null.org
EOF
mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc
mkfs.ext4 /dev/md0
cat > cloud-config.tmp << EOF
#cloud-config
hostname: $hostname
ssh_authorized_keys:
- #your ssh public key here
EOF
wget https://raw.github.com/coreos/init/master/bin/coreos-install
bash coreos-install -d /dev/sda -c cloud-config
reboot
```
```
ssh core@$IP
sudo su -
# Add swap
fallocate -l 8192m /swap
chmod 600 /swap
mkswap /swap
cat > /var/lib/coreos-install/user_data << EOF
#cloud-config
hostname: $hostname
ssh_authorized_keys:
- #your ssh public key here
write_files:
- path: /etc/sysctl.d/aio-max.conf
permissions: 0644
owner: root
content: "fs.aio-max-nr = 1048576"
- path: /etc/hosts
permissions: 0644
owner: root
content: |
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
- path: /etc/environment
permission: 0644
owner: root
content: |
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=
IP=`curl -s http://icanhazip.com/`
FirstName="Pierre"
LastName="Ozoux"
Address="23CalcadaSaoVicente"
PostalCode="1100-567"
Country="Portugal"
Phone="+351.967184553"
EmailAddress="pierre@ozoux.net"
City="Lisbon"
CountryCode="PT"
BACKUP_DESTINATION=root@xxxxx:port
MAIL_USER=contact%40indie.host
MAIL_PASS=
MAIL_HOST=mail.indie.host
MAIL_PORT=587
coreos:
update:
reboot-strategy: off
units:
- name: systemd-sysctl.service
command: restart
- name: data.mount
command: start
content: |
[Mount]
What=/dev/md0
Where=/data
Type=ext4
- name: swap.service
command: start
content: |
[Service]
Type=oneshot
ExecStart=/sbin/swapon /swap
EOF
# Create Directory structure
git clone https://github.com/indiehosters/LibrePaaS.git /indiehosters
mkdir /{data,system}
mkdir /data/trash
# Install unit-files and utils
cp /indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload
cp /indiehosters/utils/* /opt/bin/
mkdir -p /opt/bin
DOCKER_COMPOSE_VERSION=1.6.0
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose

View file

@ -1,119 +0,0 @@
IP=
hostname=
ssh -o "StrictHostKeyChecking no" root@$IP
fdisk -l #find your ssd
#Check the state of the drives
smartctl -a /dev/sda
smartctl -a /dev/sdb
smartctl -a /dev/sdc
wget https://raw.github.com/coreos/init/master/bin/coreos-install
cat > cloud-config << EOF
#cloud-config
hostname: $hostname
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCTDu9fp/BkVv7afu4HWBf9Ou/Bu0A0wmT8ELx6w2LguywKVYytubS++j1cuZ90BmK7pso22gJL8JA+z3I4YSzzX07E+/Tauug/xqWY88nk2yykIbRdYwnBQ545yDoK9b2MG+3Ih9NFNo4CTe0hfm9OC8Ztd+6/tJI85JUNjISSEuGhwkfCHUKwu5kUQDLCJg5hzbq0mpE/CAnXiX6Vs2vJL2RHuvM37CzuqjFqJq+k7OYW1Dz32PrFxOefCHCHXI5Oq2a6lWcBLHmYPx8KDk5li7XSm3HirPoPOpSgfZmFtTM7bbJmOjlJgD27tDUgM94yZoRB9qFSM3103CX1qRfLfDd/e9BDI6jbG/Jdq4Zt1PdOb4V6ee86DzO+PIOqv0P9tImMAwZDve9EfcaNjqNhWeY4oUbEuvsZ5R5BrFGvg10D7WsVs1iIJ//XYaiC+D5PG6iDjXsvR7j+auLGGMOjZNEvIJcqDmtTi2mQsZ4n9Y9M0zAKCKIGkKS+JQqZZUToRA7YV+C7JniTlxg4UZxVQgpsGhwxnWuc8YeM99byB6lbWqGTewVbDy97zXcJwHfVgx0oUNwQl0qwZ+B1LX8Cw1eei2vBzHlsVpx0G/RKn4ai1puSyYeFyTOWIc38HZ8d4ZdL2LYx2PqCTYOfHYfLY4q3Mj2SDxr/fq++0F7jbQ== pierre@ozoux.net
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDoQ/sHcgXwcmTWDAd+8uc7dk7eIpLv0T1i8gkQOamBaCV+Y9SXDlUcveWHXa0JTZJTzXn/m/O1VE5AlqP3TEKSPBxnVBya6LWuLlNNGBKmponWXIb5aIcpKHicojEcrt1KjQyc3UAKRcLz7ajgsQ+kj2GXcbXlCGIsEUx08MIV1bowxmHIKNDe/SaBUAVsHZFuE7R4okQxPYJfU5SeHogUtwon99ND4PohEmR0IYtXGTNu4ky2j+qBAIZLbXa0AR20v4dvE5apZKwmD/Uyv7sTPApm0KfqRozgi/T5Ba0OcR79AAm1XaBzT78YTO+41eV3EHTiH1Y/XIQR75iMdfTPGWcaSlU6qMoLSJ8OsGX9qOJCoWNzJSl2j7OgHchhNmf6uuZkvBR2hOpTQgDsDHHk8LVFiQ3VlDdL6mWYoxRCmKil7lycAczx7MdjfEU6QGdEfRKWpwWKV8qJEIJqhVMVKgqJOk+fxyAmC+oije+7JUEa64r30A6rwsTUkO8cI5KxxksYDsQYmZPvAMM3pxi01WTxt01gG//vC+4Hxg1OZdPwUlJdYEGKhGVSa127eKobpb460avon24a1OW9qCpiv79/qOrKUEjQX8PpPlG6oFZlAzFkLkNDDMMqhePOXapgpyclbemFC+5Xj2w/8gVJJZotPr1OzTjzfqFAUOwqw== pboua@Peters-MacBook-Air.local
write_files:
- path: /etc/sysctl.d/aio-max.conf
permissions: 0644
owner: root
content: "fs.aio-max-nr = 1048576"
- path: /etc/hosts
permissions: 0644
owner: root
content: |
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
coreos:
update:
reboot-strategy: off
units:
- name: systemd-sysctl.service
command: restart
- name: data-domains.mount
command: start
content: |
[Mount]
What=/dev/md0
Where=/data/domains
Type=ext4
EOF
bash coreos-install -d /dev/sda -c cloud-config
reboot
ssh core@$IP
sudo su -
# Create Directory structure
mkdir -p /data/domains
git clone https://github.com/indiehosters/LibrePaaS.git /data/indiehosters
# Install unit-files
cp /data/indiehosters/unit-files/* /etc/systemd/system && systemctl daemon-reload
# Setup raid
cat > /etc/mdadm.conf << EOF
MAILADDR support@indie.host
mdadm --create --verbose /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc
EOF
mkfs.ext4 /dev/md0
coreos-cloudinit --from-file=/var/lib/coreos-install/user_data
cat > /etc/environment << EOF
NAMECHEAP_URL="namecheap.com"
NAMECHEAP_API_USER="pierreo"
NAMECHEAP_API_KEY=
IP=`curl -s http://icanhazip.com/`
FirstName="Pierre"
LastName="Ozoux"
Address="23CalcadaSaoVicente"
PostalCode="1100-567"
Country="Portugal"
Phone="+351.967184553"
EmailAddress="pierre@ozoux.net"
City="Lisbon"
CountryCode="PT"
BACKUP_DESTINATION=root@xxxxx:port
ENCRYPT_KEY=
PASSPHRASE= #encrypt key passphrase
mail_username=contact%40indie.host
mail_password=
mail_hostname=mail.indie.host
MAIL_HOST=mail.indie.host
MAIL_PORT=587
MAIL_DOMAIN=indie.host
EOF
source /etc/environment
ssh-keygen -t rsa -b 4096 -C "root@$hostname"
# add the new public key to your backup server
ssh -o "StrictHostKeyChecking no" -o "BatchMode yes" -o "HostKeyAlgorithms=ssh-rsa" root@5.9.102.20 -p port exit
gpg --gen-key
mkdir -p /opt/bin
DOCKER_COMPOSE_VERSION=1.4.2
curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
# add swap
cd /data
fallocate -l 8192m ./swap
chmod 600 ./swap
mkswap ./swap
systemctl status swapon
systemctl start swapon
systemctl status swapon