Created
August 9, 2021 12:01
-
-
Save leandronsp/a53f91d003e6b179bd01f3e12f5daa2a to your computer and use it in GitHub Desktop.
Vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export BUNDLE_GITHUB__COM=<token> | |
export ANY_VARIABLE=<value> | |
postgres() { | |
docker run \ | |
--rm \ | |
--name postgres \ | |
--network=playground \ | |
--network-alias postgres \ | |
-e POSTGRES_PASSWORD=playground \ | |
-e POSTGRES_USER=playground \ | |
-e POSTGRES_DB=playground \ | |
-e PGDATA=/var/lib/postgresql/data/pgdata \ | |
-v pg_data:/var/lib/postgresql/data \ | |
-p 5432:5432 \ | |
-d \ | |
postgres:12 | |
} | |
redis() { | |
docker run \ | |
--name redis \ | |
--network=playground \ | |
--network-alias redis \ | |
-p 6379:6379 \ | |
-d \ | |
redis:alpine | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
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 | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io -y | |
sudo usermod -aG docker ubuntu | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
sudo apt-get install make vim -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
projects = %w[ | |
project-1 | |
project-2 | |
etcetc | |
] | |
Vagrant.configure("2") do |config| | |
config.vm.define "playground" do |machine| | |
machine.vm.box = "ubuntu/focal64" | |
machine.vm.provider "virtualbox" do |box| | |
box.memory = 4096 | |
box.cpus = 2 | |
end | |
machine.vm.network "private_network", ip: "10.10.10.42" | |
projects.each do |project| | |
machine.vm.synced_folder "#{ENV['HOME']}/firma/#{project}", "/home/vagrant/firma/#{project}" | |
end | |
machine.vm.synced_folder "#{ENV['HOME']}/side-projects", "/home/vagrant/side-projects" | |
machine.vm.synced_folder "#{ENV['HOME']}/backups", "/home/vagrant/backups" | |
machine.vm.provision "file", source: "./bash_aliases", destination: "$HOME/.bash_aliases" | |
machine.vm.provision "shell", path: "./configure" | |
machine.vm.provision :shell, | |
:inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/Europe/Lisbon /etc/localtime", | |
run: "always" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great