installer.sh: move installation of docker/node/nginx etc

no need to dup the code in two places. i think this will also
fix the unbound/resolvconf DNS resolution issue. this way unbound is configured
and is what gets used when docker is installed.

https://forum.cloudron.io/topic/6660/help-please-failing-setup-of-cloudron
https://forum.cloudron.io/topic/6632/help-me-please-got-error-while-installing-the-cloudron-on-a-fresh-ubuntu-20-04-x64-server
https://forum.cloudron.io/topic/6561/that-install-script-fails-74-times-out-of-75
This commit is contained in:
Girish Ramakrishnan
2022-03-29 22:11:43 -07:00
parent 5b27eb9c54
commit bfb233eca1
3 changed files with 16 additions and 55 deletions

View File

@@ -71,10 +71,15 @@ readonly is_update=$(systemctl is-active -q box && echo "yes" || echo "no")
log "Updating from $(cat $box_src_dir/VERSION) to $(cat $box_src_tmp_dir/VERSION)"
log "updating docker"
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
readonly docker_version=20.10.12
if [[ $(docker version --format {{.Client.Version}}) != "${docker_version}" ]]; then
if ! which docker 2>/dev/null || [[ $(docker version --format {{.Client.Version}}) != "${docker_version}" ]]; then
log "installing/updating docker"
# create systemd drop-in file already to make sure images are with correct driver
mkdir -p /etc/systemd/system/docker.service.d
echo -e "[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// --log-driver=journald --exec-opt native.cgroupdriver=cgroupfs --storage-driver=overlay2 --experimental --ip6tables" > /etc/systemd/system/docker.service.d/cloudron.conf
# there are 3 packages for docker - containerd, CLI and the daemon
$curl -sL "https://download.docker.com/linux/ubuntu/dists/${ubuntu_codename}/pool/stable/amd64/containerd.io_1.4.9-1_amd64.deb" -o /tmp/containerd.deb
$curl -sL "https://download.docker.com/linux/ubuntu/dists/${ubuntu_codename}/pool/stable/amd64/docker-ce-cli_${docker_version}~3-0~ubuntu-${ubuntu_codename}_amd64.deb" -o /tmp/docker-ce-cli.deb
@@ -87,8 +92,8 @@ if [[ $(docker version --format {{.Client.Version}}) != "${docker_version}" ]];
fi
readonly nginx_version=$(nginx -v 2>&1)
if [[ "${nginx_version}" != *"1.20."* ]]; then
log "installing nginx 1.20"
if ! which nginx 2>/dev/null || [[ "${nginx_version}" != *"1.20."* ]]; then
log "installing/updating nginx 1.20"
$curl -sL http://nginx.org/packages/ubuntu/pool/nginx/n/nginx/nginx_1.20.0-1~${ubuntu_codename}_amd64.deb -o /tmp/nginx.deb
prepare_apt_once
@@ -98,9 +103,9 @@ if [[ "${nginx_version}" != *"1.20."* ]]; then
rm /tmp/nginx.deb
fi
log "updating node"
readonly node_version=16.13.1
if [[ "$(node --version)" != "v${node_version}" ]]; then
if ! which node 2>/dev/null || [[ "$(node --version)" != "v${node_version}" ]]; then
log "installing/updating node ${node_version}"
mkdir -p /usr/local/node-${node_version}
$curl -sL https://nodejs.org/dist/v${node_version}/node-v${node_version}-linux-x64.tar.gz | tar zxvf - --strip-components=1 -C /usr/local/node-${node_version}
ln -sf /usr/local/node-${node_version}/bin/node /usr/bin/node