Skip to content

Instantly share code, notes, and snippets.

@spaced
Last active January 7, 2018 20:52
Show Gist options
  • Save spaced/d5b2e99ea8db23a90283727bfb4138af to your computer and use it in GitHub Desktop.
Save spaced/d5b2e99ea8db23a90283727bfb4138af to your computer and use it in GitHub Desktop.
discourse ec2
# create instance using https://aws.amazon.com/marketplace/fulfillment?productId=b7ee8a69-ee97-4a49-9e68-afaee216db2e&launch=oneClickLaunch
# use west-2b (us oregon, subnet-5d371e38)
# create swap (https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880)
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
#attach data volume with ec2 console to instance
#mount
sudo mkdir /var/discourse
sudo echo "/dev/xvdf /var/discourse ext4 noatime 0 0" | sudo tee -a /etc/fstab
sudo mount -a
# install docker-ce because overlay2 and more uptodate (https://docs.docker.com/engine/installation/linux/docker-ce/centos/#set-up-the-repository)
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
yum install git
echo '{ "storage-driver": "overlay2", "storage-opts": [ "overlay2.override_kernel_check=true" ] }' >/etc/docker/daemon.json
#deactivate selinux
sudo setenforce 0
systemctl enable docker
systemctl start docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment