diff --git a/INSTALL.md b/INSTALL.cloud.md similarity index 100% rename from INSTALL.md rename to INSTALL.cloud.md diff --git a/INSTALL_LINUX.md b/INSTALL_LINUX.md index 48affbb2f3775fa9448b8e9aba21f6c3394c66b9..ba9ac60b1c75f8958473e4bfc9364a10c1fd18b5 100644 --- a/INSTALL_LINUX.md +++ b/INSTALL_LINUX.md @@ -1,14 +1,14 @@ # Instructions to install libre.sh on linux with Systemd ## Recommendation -- Systemd (debian 8 or debian 9, CentOS 7 ...) +- Systemd distro (ubuntu server 18.04.3 or debian 9 ) # Installation Where basicly reproduce what the user_data do for us. as root -# configure sshd +# configure sshd (Optional) Don't forget to create the user core and adding your ssh key before You could also remove AllowUsers core or/and change the username. @@ -25,7 +25,7 @@ chmod 600 /etc/ssh/sshd_config systemctl restart sshd ``` -# add kernel parameter +# add kernel parameter (optional but recommended ) ``` cat > /etc/sysctl.d/libresh.conf <<EOF @@ -39,7 +39,7 @@ sysctl -p /etc/sysctl.d/libresh.conf echo never > /sys/kernel/mm/transparent_hugepage/enabled ``` -# define Localhost +# define Localhost (should not be needed but... ) ``` cat > /etc/hosts <<EOF @@ -74,6 +74,10 @@ MAIL_PORT=587 EOF ``` +# install docker + +*Current tested version : 19.03.5 see https://docs.docker.com/install/linux/docker-ce/ubuntu/ .* + # install docker-compose *Remark I did a variante to find the last version of DockerCompose and download it* @@ -88,11 +92,12 @@ chmod +x /opt/bin/docker-compose ``` git clone https://lab.libreho.st/libre.sh/compose.libre.sh /libre.sh &&\ -mkdir /{data,system} &&\ -mkdir /data/trash &&\ +mkdir -p /{data,system} &&\ +mkdir -p /data/trash &&\ 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/ ``` diff --git a/README.md b/README.md index 05419c0a5793dee37f4802257642b6093290ef17..8972286e731b0d7f812fa0397f7d0b5334d6accc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Introduction -A ecosystem that is aimed at hosting free software \o/ +An ecosystem to ease free software hosting \o/ We are working on bootstrapping an ecosystem of tools to facilitate the hosting of free software. Think of it as @@ -12,15 +12,23 @@ Think of it as - FLOSS [cpanel](https://www.cpanel.net/products/) - [cloudron](https://cloudron.io/) with email -for [kubernetes](https://kubernetes.io/). -This ecosystem can be deployed on [Raspberries](https://kubecloud.io/setting-up-a-kubernetes-1-11-raspberry-pi-cluster-using-kubeadm-952bbda329c8) or on popular cloud providers and scale globally or anything in between. We can affirm that it scales globally because it is based on kubernetes, a tool developped from the experience of Google hosting containers at scale. + * Libre.sh V1 (Stable) is using docker-compose + * Libre.sh V2 (Alpha) is using [kubernetes](https://kubernetes.io/). + + +This ecosystem can be deployed on [Raspberries](https://kubecloud.io/setting-up-a-kubernetes-1-11-raspberry-pi-cluster-using-kubeadm-952bbda329c8) or on popular cloud providers and scale globally or anything in between. +We can affirm that V2 scales globally because it is based on kubernetes, a tool developped from the experience of Google hosting containers at scale. ## Installation -[](https://fosdem.org/2017/schedule/event/libre_sh/) -To install it, follow the video above and instructions in `INSTALL.md`. + +To install it, follow the instructions in `INSTALL_LINUX.md` : https://lab.libreho.st/libre.sh/compose.libre.sh/blob/master/INSTALL_LINUX.md + +Or run our installer script + +https://lab.libreho.st/libre.sh/compose.libre.sh/raw/master/install.linux.sh ### What is libre.sh @@ -46,7 +54,7 @@ Amazing, right? The PaaS is really modular, that's why it contains the strict necessary, then you'll probably want to add `system` modules or `applications`. -It contains 2 [unit-files](https://github.com/indiehosters/LibrePaaS/tree/master/unit-files) to manage system modules and applications, start them at boot, and load the appropriate environment. +It contains 2 [unit-files](https://lab.libreho.st/libre.sh/compose.libre.sh/tree/master/unit-files) to manage system modules and applications, start them at boot, and load the appropriate environment. ### Support @@ -56,17 +64,18 @@ You can use the following channels to request community support: For paid support, just send an inquiry to support@libre.sh. +You can also watch the Fosdem Video : [Video Fosdem](https://fosdem.org/2017/schedule/event/libre_sh/) + All of this is hosted by libre.sh :) ## System modules Here is a list of modules supported: - https proxy: - - [HAProxy](https://github.com/indiehosters/haproxy) - - [Nginx](https://github.com/indiehosters/nginx) - - [monitoring](https://github.com/indiehosters/monitoring) - - [git-puller](https://github.com/indiehosters/git-puller) - - [backups](https://github.com/indiehosters/backups) + - [HAProxy](https://lab.libreho.st/libre.sh/compose/haproxy) + - [Nginx](https://lab.libreho.st/libre.sh/compose/nginx) + - [monitoring](https://lab.libreho.st/libre.sh/compose/monitoring) + - [git-puller](https://lab.libreho.st/libre.sh/compose/git-puller) Go to their respective page for more details. @@ -74,7 +83,7 @@ Go to their respective page for more details. ``` cd /system/ -git clone module +git clone https://lab.libreho.st/libre.sh/compose/[module] cd module libre enable libre start @@ -144,3 +153,15 @@ Support this project by becoming a sponsor. Your logo will show up here with a l <a href="https://opencollective.com/libresh/sponsor/9/website" target="_blank"><img src="https://opencollective.com/libresh/sponsor/9/avatar.svg"></a> +## Other projects + + +Simplifying web application hosting has always been a goal for a lot of other projects, here is some project that share goals with libre.sh + + + + - Yunohost https://yunohost.org + - Sandstorm https://sandstorm.io/ + - Cloudron https://git.cloudron.io/cloudron/box + + diff --git a/install.linux.sh b/install.linux.sh new file mode 100755 index 0000000000000000000000000000000000000000..8b5051d9d18db1c929c9efb6db9386411822c6c2 --- /dev/null +++ b/install.linux.sh @@ -0,0 +1,128 @@ +#!/bin/bash + +#Current version of libre.sh to be installed +LIBRE_VERSION=187-repo-mode-to-retrieve-application-recipe +# System env vars : can be overrided by a values.env file next to this install file + + +### CONFIG : Specify you template repo ROOT without training slash (Optional) or comment if you want to supply full url for apps + +APP_REPO_URL="lab.libreho.st/libre.sh/compose" + +## domain handling + +### CONFIG : change to your domain vendor ( namecheap, ovh , scaleway, ) +DOMAIN_SERVER=namecheap + +### Namecheap specific +NAMECHEAP_URL="namecheap.com" +NAMECHEAP_API_USER="pierreo" +NAMECHEAP_API_KEY= + +### ovh specific (WIP) +OVH_URL="eu.api.ovh.com" +OVH_API_USER="" +OVH_API_KEY= + + +### Scaleway specific (WIP) +SCALEWAY_URL="" +SCALEWAY_API_USER="" +SCALEWAY_API_KEY= + + +### TODO : change your settings +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 + +### CONFIG : Change your mail settings. +## SMTP +MAIL_USER= +MAIL_PASS= +MAIL_HOST=mail.indie.host +MAIL_PORT=587 + +### TODO : source a setting file is present to override defaults + +echo "-------- Welcome to libre.sh $LIBRE_VERSION installer" + +echo "---- sourcing local values.env file if present" + +source values.env + + +# STEP add kernel parameter + +# STEP Define environnement + +echo "-------- setting up system variables" + +echo "APP_REPO_URL=${APP_REPO_URL}" >> /etc/environment + +echo "LIBRE_VERSION=${LIBRE_VERSION}" >> /etc/environment + +echo "MAIL_USER=${MAIL_USER}" >> /etc/environment + +echo "MAIL_PASS=${MAIL_PASS}" >> /etc/environment + +echo "MAIL_HOST=${MAIL_HOST}" >> /etc/environment + +echo "MAIL_PORT=${MAIL_PORT}" >> /etc/environment + + +# 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 + + +# STEP "install docker-compose" +echo "-------- Install latest docker-compose " + +# 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 + + + +# STEP install Libre.sh + +echo "-------- installing libre.sh" + +git clone https://lab.libreho.st/libre.sh/compose.libre.sh -b $LIBRE_VERSION /libre.sh +mkdir -p /{data,system} +mkdir -p /data/trash +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/ + + +# STEP add /opt/bin path + + +echo "-------- updating PATH" +cat > /etc/profile.d/libre.sh <<EOF +export PATH=$PATH:/opt/bin +EOF +chmod 644 /etc/profile.d/libre.sh +bash /etc/profile.d/libre.sh + diff --git a/utils/provision b/utils/provision index 2f6a4ad2b4d448416fcccebadf8c2a5c975517cc..d8dfac69505438985243b6b7a447f6ed291db76e 100755 --- a/utils/provision +++ b/utils/provision @@ -104,8 +104,29 @@ function buy_domain_name () { } function application () { - git clone https://${arg_a}.git /data/domains/${arg_u} -t ${arg_t} + + #We check if a APP_REPO_URL was specified + + if [ -z ${APP_REPO_URL:-} ]; then + warning "NO repo URL specified, using argument as full URL" + git_url=https://${arg_a}.git + else + warning "REPO specified, using argument as app name" + git_url=https://${APP_REPO_URL}/${arg_a}.git + fi + + #Define the tag/branch + + if [ -z ${arg_t:-} ]; then + warning "No tag/branch specified, Using master " + git_tag=master + else + git_tag=${arg_t} + fi + git clone ${git_url} -b ${arg_t} /data/domains/${arg_u} + cd /data/domains/${arg_u} + if [ -f ./scripts/install ]; then export URL=${arg_u} if [ -z ${MAIL_DOMAIN:-} ]; then