Skip to content

Instantly share code, notes, and snippets.

View chris1984's full-sized avatar

Chris Roberts chris1984

View GitHub Profile
$ cat ~/bin/rails-start
#!/usr/bin/bash
cd ~/git/foreman
rm log/development.log
export DISABLE_SPRING=1
export NOTIFICATIONS_POLLING=999999
be puma -b 'tcp://0.0.0.0' -p 3000 #-w 1
#rails s -b '0.0.0.0'
@jeremylenz
jeremylenz / hammer-hack.sh
Last active August 10, 2023 14:50
steal partha's hammer settings and get hammer working on devel box
cd ~/hammer-cli-katello
bundle install
bundle exec bash
cd ~
wget https://partha.fedorapeople.org/devel/hammer.tgz
tar zxf hammer.tgz
ll .hammer # verify there's stuff in that dir
cd hammer-cli-katello
hammer ping
# Change Foreman's logging gem settings to log the full logger name instead of just the first 3 characters
# config/logging.yaml#L94
:pattern: "%d [%.1l|%c|%.8X{request}] %m\n"
# Log the line, file, and method that calls logger.debug (useless because it's always method_missing):
log_trace: true # can also use %F, %L, %M in the pattern now
@jeremylenz
jeremylenz / virsh-snapshot-commands.sh
Last active January 31, 2020 19:44 — forked from johnpmitsch/blah.sh
vagrant/virsh snapshot commands bashrc
# Add to your ~/.bashrc, then run source ~/.bashrc
# virsh-snapshot-create mybox mysnap
# Run in forklift directory
function virsh-snapshot-create {
vagrant halt $1
virsh snapshot-create-as forklift_$1 $2
vagrant up $1
}
@johnpmitsch
johnpmitsch / bb.md
Created April 4, 2019 16:55
katello debugging with remote byebug
  • cd ~/foreman
  • echo "gem 'byebug'" >> bundler.d/katello.local.rb
  • bundle install
  • create and add the following to config/initializers/byebug.rb
require 'byebug/core'
if Rails.env.development?
  Byebug.start_server 'localhost', ENV.fetch("BYEBUG_SERVER_PORT", 1048).to_i
end
@johnpmitsch
johnpmitsch / servers.sh
Last active June 11, 2019 15:40
Katello - kill rails and webpack functions
function kill_servers {
# kill node server
kill -9 $(ss -tulpn | grep 3808 | awk '{ print $7}' | awk -F'[=|,]' '{ print $3 }') 2> /dev/null
#kill rails server
if [ -f /home/vagrant/foreman/tmp/pids/server.pid ]; then
kill -9 $(cat /home/vagrant/foreman/tmp/pids/server.pid)
fi
}
@mccun934
mccun934 / httpd access log rate commands.md
Last active October 24, 2018 21:22
Httpd log rate commands

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@johnpmitsch
johnpmitsch / blah.md
Created July 31, 2018 15:17
restart services in katello dev environment

sudo systemctl restart postgresql rh-mongodb34-mongod qdrouterd qpidd squid pulp_resource_manager pulp_streamer foreman-proxy pulp_celerybeat pulp_workers tomcat httpd puppetserver

# EG : ALTER USER Postgres WITH PASSWORD '<newpassword>';
CP_PASS=`grep jpa.config.hibernate.connection.password /etc/candlepin/candlepin.conf | awk -F= '{print $2}'`
F_PASS=`grep password /etc/foreman/database.yml | awk -F: '{print $2}' | sed 's/"//g'`
echo "ALTER USER candlepin WITH PASSWORD '$CP_PASS';" | sudo -u postgres psql
echo "ALTER USER foreman WITH PASSWORD '$F_PASS';" | sudo -u postgres psql