Skip to content

Instantly share code, notes, and snippets.

@kevinlinxc
Last active June 21, 2022 17:26
Show Gist options
  • Save kevinlinxc/82044f2674fbc4faf2c517e825b39818 to your computer and use it in GitHub Desktop.
Save kevinlinxc/82044f2674fbc4faf2c517e825b39818 to your computer and use it in GitHub Desktop.
Rubygems.org Database Seeding
#!/bin/sh
set -e # exit immediately if any command fails
# Warning:
# Resets the db
# Assumptions:
# This script is run from rubygems.org root directory
# elasticsearch, memcached, and postgresql are running. For me, this meant
# docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:7.10.1
# memcached
# And the Postgresql initialized throught the Postgres app gui
# install all gems before trying any rails commands
bundle install
# reset db
bin/rails db:reset
# Download and load the userless data dump, for the gems
./script/load-pg-dump -d rubygems_development -c ~/Downloads/public_postgresql.tar
# Download Betty's seed user script (with modifications from Kevin)
# Normal link: https://github.com/Shopify/rubygems.org/blob/cf874dbaeaf933ec278a7fb293671981595cc28d/lib/tasks/gem_owners.rake
curl -H 'Accept: application/vnd.github.v3.raw' -o ./lib/tasks/gem_owners.rake -L https://raw.githubusercontent.com/Shopify/rubygems.org/cf874dbaeaf933ec278a7fb293671981595cc28d/lib/tasks/gem_owners.rake
# Run the rake seed task
rake gem_owners:seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment