Last active
August 30, 2015 11:51
-
-
Save danhper/82261f02f07c8d669468 to your computer and use it in GitHub Desktop.
Vagrantfile to reproduce issue in Phoenix configuration reload
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
# Start the VM with `vagrant up` | |
# After everything runs, enter the VM with `vagrant ssh` | |
# The app lives in the `blog` directory | |
# After running `mix deps.get && mix ecto.create`, `mix phoenix.server` should work | |
# The page will be accessible at 192.168.50.4:4000 from the host machine | |
# | |
# Some utility scripts are available in the project directory: | |
# | |
# * break_it.sh: breaks the app by modifying web/controllers/page_controller.ex | |
# * fix_it.sh: undo break_it.sh changes | |
# * catch_mode.sh: edits config/dev.exs to enable `catch_errors` and disable `debug_errors` | |
# * debug_mode.sh: edits config/dev.exs to restore `debug_errors` | |
Vagrant.configure(2) do |config| | |
config.vm.box = "hashicorp/precise64" | |
config.vm.network "private_network", ip: "192.168.50.4" | |
config.vm.provision "shell", inline: <<-SHELL | |
locale-gen en_US.UTF-8 | |
update-locale LANG=en_US.UTF-8 | |
sed -ie 's/LC_ALL="en_US"/LC_ALL="en_US.UTF-8"/' /etc/default/locale | |
export LANG="en_US.UTF-8" | |
export LC_ALL="en_US.UTF-8" | |
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && dpkg -i erlang-solutions_1.0_all.deb | |
wget -q -O- https://deb.nodesource.com/setup | bash - | |
apt-get install -y git nodejs elixir postgresql-9.1 inotify-tools | |
npm install -g brunch | |
su - postgres -c "echo alter user postgres with password \\'postgres\\' | xargs -d '\n' psql -U postgres -d postgres -c" | |
su - vagrant -c 'mix archive.install --force https://github.com/phoenixframework/phoenix/releases/download/v1.0.0/phoenix_new-1.0.0.ez' | |
su - vagrant -c 'mix phoenix.new blog' | |
su - vagrant -c "sed -i -e 's/localhost/0.0.0.0/' blog/config/config.exs" | |
su - vagrant -c "sed -i -e '11 a\ catch_errors: false,' blog/config/dev.exs" | |
su - vagrant -c 'cd blog && npm install' | |
su - vagrant -c "cd blog && echo sed -i -e \\'11s/true/false/\\' -e \\'12s/false/true/\\' config/dev.exs > catch_mode.sh" | |
su - vagrant -c "cd blog && echo sed -i -e \\'11s/false/true/\\' -e \\'12s/true/false/\\' config/dev.exs > debug_mode.sh" | |
su - vagrant -c "cd blog && echo sed -i -e \\'s/index.html/index.htm/\\' web/controllers/page_controller.ex > break_it.sh" | |
su - vagrant -c "cd blog && echo sed -i -e \\'s/index.htm/index.html/\\' web/controllers/page_controller.ex > fix_it.sh" | |
su - vagrant -c "cd blog && chmod +x catch_mode.sh debug_mode.sh break_it.sh fix_it.sh" | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment