Skip to content

Instantly share code, notes, and snippets.

@garethrees
Last active November 9, 2021 16:13
Show Gist options
  • Save garethrees/a8b314fbcd7396e740f1 to your computer and use it in GitHub Desktop.
Save garethrees/a8b314fbcd7396e740f1 to your computer and use it in GitHub Desktop.
Alaveteli dev install
# Host
# ------------------------------------------------------------------------------
# Go to your main code directory
cd ~/Code
# Clone alaveteli
git clone --recursive https://github.com/mysociety/alaveteli.git
cd alaveteli
git checkout master # Or the specific version a site is running on, e.g. `0.20.0.14`
# Make the themes directory and clone the theme
mkdir -p ../alaveteli-themes
pushd ../alaveteli-themes
git clone git@github.com:YOUR_GITHUB_USERNAME/dirittodisapere-theme.git
popd
# Create the VM
cd alaveteli
ALAVETELI_VAGRANT_MEMORY=3072 ALAVETELI_VAGRANT_FQDN=10.10.10.30 vagrant up
# If fails on Debian:
vagrant ssh -c "sudo apt -y install linux-headers-amd64"
vagrant provision
vagrant ssh
# Guest
# ------------------------------------------------------------------------------
cd alaveteli
cp config/general.yml config/general-dirittodisapere-theme.yml
rm config/general.yml
# Edit config/general-dirittodisapere-theme.yml:
#
# DOMAIN: 10.10.10.30
# THEME_URL:
# - https://github.com/YOUR_GITHUB_USERNAME/dirittodisapere-theme
script/switch-theme.rb dirittodisapere-theme
bundle exec rake assets:clean
bundle exec rails s -b 0.0.0.0
# Host
# ------------------------------------------------------------------------------
open http://10.10.10.30:3000
@garethrees
Copy link
Author

garethrees commented Aug 11, 2017

Some other things:

  • Install dotfiles
  • Remove git prompt
  • Set git email
  • Add IPV4 IPV6 "trust" to vagrant user all dbs 0.0.0.0/0 / ::1/128 in pg_hba.conf to browse DBs with Postico app:
sudo find / -name pg_hba.conf
# /etc/postgresql/10/main/pg_hba.conf

# Put these above existing
host    all             vagrant         0.0.0.0/0               trust
host    all             vagrant         ::1/128                 trust


sudo service postgresql reload
  • Disable crons & deamons
sudo rm /etc/init.d/alaveteli-*
sudo rm /etc/cron.d/alaveteli*

@garethrees
Copy link
Author

Need to sudo apt-get -y remove bundler && sudo gem install bundler after installing a brightbox-provided Ruby.

@garethrees
Copy link
Author

vagrant ssh-config to update Postico connection details – usually just need to update the private key.

@garethrees
Copy link
Author

Alaveteli does this automatically, but for future ref, creating vagrant as postgres superuser:

sudo -u postgres createuser --createdb --no-createrole --no-superuser 'vagrant'

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