Skip to content

Instantly share code, notes, and snippets.

@jennyd
Last active March 6, 2019 14:28
Show Gist options
  • Save jennyd/92c3fc9bd569f1366e00f6d514d609e9 to your computer and use it in GitHub Desktop.
Save jennyd/92c3fc9bd569f1366e00f6d514d609e9 to your computer and use it in GitHub Desktop.
Getting started with local development on Transition (without the GOV.UK dev VM)
# Prerequisites:
# - ruby 2.6.1 (or another relatively recent version is probably fine too) and bundler installed
# - postgres 9.3+ running (I've used 9.6 and 10.7 and they were both fine)
# - if you're creating more than 100 mappings at once, the app processes that in the background using Sidekiq with Redis, but the app runs fine without Redis otherwise
git clone [email protected]:alphagov/transition.git
cd transition
bundle install
bundle exec rake db:setup
# This clones the alphagov/transition-config repo into the location where the orgs_sites_hosts import task expects it to be (in data/):
bundle exec rake notmodules:sync
# This makes the organisations import use the live API instead of a local development one:
export GOVUK_WEBSITE_ROOT="https://www.gov.uk"
# Import config data:
bundle exec rake import:all:orgs_sites_hosts
bundle exec rake import:dns_details
# Run the application:
bundle exec rails s
# Go to http://localhost:3000 🎉
# The app uses GOV.UK's Signon service for auth but you don't need to have that running locally - it uses a fake auth strategy in dev.
# To give the default test user (which you're automatically logged in as) permissions to edit URL mappings for all sites, rather than just Cabinet Office ones:
bundle exec rails console
> u = User.first
> u.permissions += ['GDS Editor']
> u.save
# To import a single site yaml file (they live in the transition-config repo) while you're working on it:
bundle exec rake import:orgs_sites_hosts[path/to/file]
# If you're trying stuff out locally and want to completely delete a site you've imported and any mappings you've created for it:
bundle exec rake import:revert_entirely_unsafe[site_abbr]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment