Skip to content

Instantly share code, notes, and snippets.

@daveed
Last active October 18, 2018 00:14
Show Gist options
  • Save daveed/0132d3b16063c3622bfd13a487617a68 to your computer and use it in GitHub Desktop.
Save daveed/0132d3b16063c3622bfd13a487617a68 to your computer and use it in GitHub Desktop.
debug travis build locally with Docker
  • get latest docker travis build tag and run it in the background

      docker run -dit travisci/ci-ruby:packer-1494868441 /sbin/init
    
  • exec container

      docker exec -it <container_id> bash -l
    
  • change user

      su - travis
    
  • install ruby 2.5.1

      rvm use 2.5.1 --install --binary --fuzzy
      ruby -v
    
  • add your ssh keys and chmod 600

  • add your git config user and email

  • clone the repo

      git clone --depth=50 --branch=master git@github.com:element-group/ico-platform.git
    
  • gem update

      gem update --system
      gem update bundler
    
  • run install commands script

  • start redis

      redis-server&
    
  • postgres

      sudo apt-get update
      sudo apt-get upgrade
    
  • enable postgres crypto

      CREATE EXTENSION pgcrypto;
    
      SHOW config_file;
    

    /etc/postgresql/9.5/main/postgresql.conf

      listen: localhost *
    

    /etc/postgresql/9.5/main/pg_hba.conf

      local  all  travis trust
      host  all   travis 0.0.0.0/0  trust
      host  all   travis ::/0 trust
    
  • set environment variables

      export MY_VAR=my_value
    
  • migrate

      ./bin/rails db:environment:set RAILS_ENV=test
      ./bin/rake db:schema:load
    

save your local image regularly

    docker commit <container_id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment