Skip to content

Instantly share code, notes, and snippets.

@vinayakkulkarni
Last active February 27, 2022 15:11
Show Gist options
  • Save vinayakkulkarni/d4821983e8ef15e8c3113e4764830985 to your computer and use it in GitHub Desktop.
Save vinayakkulkarni/d4821983e8ef15e8c3113e4764830985 to your computer and use it in GitHub Desktop.
Setting up Laravel Project using Vessel on EC2

Setting up Laravel Projects using Vessel

Install Docker & docker-compose

Installing Docker

  • Update the apt package index:
sudo apt-get update
  • Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
  • Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • Use the following command to set up the stable repository
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • Install Docker Community Edition
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io -y
  • Test Docker is installed or not
sudo docker run hello-world

Installing docker-compose

  • Run this command to download the latest version of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
  • Test the installation.
docker-compose --version

Note: You need to add the current user to the docker group

sudo usermod -aG docker ${USER}
  • Restart the container once
sudo init 6

Ensure you have the correct version of .env in your project directory before you perform the next steps

  • Goto the cloned project directory & start the containers:
./vessel start
@vinayakkulkarni
Copy link
Author

Adding Swap

sudo fallocate -l 1G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo cp /etc/fstab /etc/fstab.bak && echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Link – https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment