Skip to content

Instantly share code, notes, and snippets.

@brunobertolini
Last active August 7, 2018 19:44
Show Gist options
  • Save brunobertolini/2d97b9bec09bfed9f5bbbded6fd0c932 to your computer and use it in GitHub Desktop.
Save brunobertolini/2d97b9bec09bfed9f5bbbded6fd0c932 to your computer and use it in GitHub Desktop.
Instance setup scripts
#!/bin/bash
include .env
.PHONY: ssh-auth-keys mongo-data-mount docker-install docker-compose-install setup
# VARIABLES --------------------------------------------------------------------
DATA_VOLUM := 'xvdb'
# SETUP ------------------------------------------------------------------------
ssh-auth-keys:
sed -i -e 's/#AuthorizedKeysFile/AuthorizedKeysFile/g' /etc/ssh/sshd_config \
&& service ssh restart
mongo-data-mount:
mkdir /data \
&& mkfs.xfs /dev/${DATA_VOLUM} \
&& echo '/dev/${DATA_VOLUM} /data xfs defaults,auto,noatime,noexec 0 0' | sudo tee -a /etc/fstab \
&& mount /data \
docker-install:
apt-get update \
&& apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D \
&& apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' \
&& apt-get update \
&& apt-cache policy docker-engine \
&& apt-get install -y docker-engine \
&& systemctl status docker
docker-compose-install:
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(shell uname -s)-$(shell uname -m) -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
setup: ssh-auth-keys mongo-data-mount docker-install docker-compose-install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment