2017-01-07 12:22:24 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
REQUIRED_PLUGINS = %w(vagrant-libvirt)
|
|
|
|
exit unless REQUIRED_PLUGINS.all? do |plugin|
|
|
|
|
Vagrant.has_plugin?(plugin) || (
|
|
|
|
puts "The #{plugin} plugin is required. Please install it with:"
|
|
|
|
puts "$ vagrant plugin install #{plugin}"
|
|
|
|
false
|
|
|
|
)
|
|
|
|
end
|
2017-05-04 02:36:36 +00:00
|
|
|
|
2017-01-07 14:28:49 +00:00
|
|
|
$provision = <<SCRIPT
|
2022-12-10 04:41:54 +00:00
|
|
|
# see SETUP.md for details
|
|
|
|
|
|
|
|
# packages
|
|
|
|
#all | sudo pacman -Syu --noconfirm base-devel
|
|
|
|
sudo pacman -Syu --noconfirm base-devel git libidn
|
|
|
|
sudo pacman -Syu --noconfirm ruby ruby-bundler ruby-irb redis postgresql yarn
|
|
|
|
git clone https://aur.archlinux.org/ruby-foreman.git
|
|
|
|
cd ruby-foreman
|
|
|
|
yes | sudo -u vagrant makepkg -si
|
|
|
|
|
|
|
|
# treehouse mastodon files are synced here
|
|
|
|
cd /vagrant
|
|
|
|
|
|
|
|
## database
|
|
|
|
if [ -d "data/" ]; then rm -rf data/; fi
|
|
|
|
mkdir -p data/
|
|
|
|
pg_ctl -D data/postgres initdb -o '-U mastodon --auth-host=trust'
|
|
|
|
echo 'unix_socket_directories = .' >> data/postgres/postgresql.conf
|
|
|
|
pg_ctl -D data/postgres start --silent
|
|
|
|
|
|
|
|
# redis
|
|
|
|
mkdir -p data/redis
|
|
|
|
redis-server ./redis-dev.conf
|
|
|
|
|
|
|
|
# ruby
|
|
|
|
export RAILS_ENV=development
|
|
|
|
if [ -d "vendor/bundle/" ]; then rm -rf vendor/bundle/; fi
|
|
|
|
bundle config set --local path 'vendor/bundle/'
|
2017-01-07 12:22:24 +00:00
|
|
|
bundle install
|
|
|
|
yarn install
|
2022-12-10 04:41:54 +00:00
|
|
|
bundle exec rake db:setup
|
2017-01-07 12:22:24 +00:00
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
# run mastodon
|
|
|
|
export NODE_ENV=development
|
|
|
|
bundle exec rake assets:precompile
|
|
|
|
foreman start
|
2017-01-07 12:22:24 +00:00
|
|
|
|
|
|
|
SCRIPT
|
|
|
|
|
2017-01-07 14:28:49 +00:00
|
|
|
$start = <<SCRIPT
|
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
export NODE_ENV=development
|
|
|
|
export RAILS_ENV=development
|
|
|
|
cd /vagrant
|
|
|
|
pg_ctl -D data/postgres start --silent
|
|
|
|
redis-server ./redis-dev.conf
|
|
|
|
foreman start
|
2017-01-07 14:28:49 +00:00
|
|
|
|
|
|
|
SCRIPT
|
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
Vagrant.configure("2") do |config|
|
2017-01-07 12:22:24 +00:00
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
config.vagrant.plugins = "vagrant-libvirt"
|
2017-01-07 12:22:24 +00:00
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
config.vm.box = "archlinux/archlinux"
|
2018-09-16 18:49:15 +00:00
|
|
|
config.vm.hostname = "mastodon.local"
|
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
# vagrant ssh -- -R 3000:localhost:3000 (:
|
|
|
|
#config.vm.network :forwarded_port, guest: 3000, host: 3000
|
2017-04-05 18:53:39 +00:00
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
config.vm.synced_folder ".", "/vagrant",
|
|
|
|
type: "rsync",
|
|
|
|
rsync__args: ["--verbose", "--archive", "--delete", "-z"],
|
|
|
|
rsync__exclide: ".git/"
|
2017-01-07 14:28:49 +00:00
|
|
|
|
|
|
|
config.vm.provision :shell, inline: $provision, privileged: false
|
|
|
|
config.vm.provision :shell, inline: $start, run: 'always', privileged: false
|
2017-01-07 12:22:24 +00:00
|
|
|
|
2022-12-10 04:41:54 +00:00
|
|
|
config.vm.provider :libvirt do |libvirt|
|
|
|
|
libvirt.driver = "kvm"
|
|
|
|
libvirt.memory = 4096
|
|
|
|
libvirt.cpus = 4
|
|
|
|
end
|
|
|
|
|
2017-01-07 12:22:24 +00:00
|
|
|
end
|