Skip to content

Instantly share code, notes, and snippets.

View jrafanie's full-sized avatar

Joe Rafaniello jrafanie

  • New Jersey
View GitHub Profile
@jrafanie
jrafanie / gist:34313d97a9e5c5238e3d
Last active February 16, 2024 16:17
Extract build and system from manageiq.git
  • build and system directories extracted to manageiq-appliance repo.
  • Make that work by building off a fork of manageiq with build and system removed
  • Split manageiq-appliance(build/system) to manageiq-appliance-build and manageiq-appliance, removing the leading build/system directories.
    • Apply manageiq build directory commits to manageiq-appliance-build.
    • Apply manageiq-appliance build directory commits to manageiq-appliance-build.
    • Save off the system commits from manageiq-appliance. (NONE)
    • Delete manageiq-appliance, recreate it.
    • Apply manageiq system directory commits to manageiq-appliance.
    • Apply old manageiq-appliance system directory commits to manageiq-appliance. (NONE)
  • Make the build work(like step 2) but with the 3 repos.
@jrafanie
jrafanie / make_engine_zeitwerk_friendly.txt
Last active April 25, 2023 14:37
Make manageiq-decorators engine more zeitwerk friendly
# This gem with my changes can be found here: https://github.com/ManageIQ/manageiq-decorators/compare/master...jrafanie:manageiq-decorators:zeitwerk
joerafaniello@Joes-MacBook-Pro-2 manageiq-decorators % tree lib
lib
├── manageiq
│   ├── decorators
│   │   ├── engine.rb
│   │   └── version.rb
│   └── decorators.rb
├── manageiq-decorators.rb
@jrafanie
jrafanie / readme.md
Last active March 31, 2023 15:54
Verifying local development logical replication works and then testing the replication settings in the UI for both remote and global
  1. Determine your data directory:

psql -U root vmdb_development -c "show data_directory;"

  1. Edit: DATA_DIRECTORY_FROM_STEP1/pg_hba.conf

Ensure this line is added:

local replication all trust

Summary:

One would expect the before and after checkout callback would wrap checkout or the undlying code that creates a new adapter and assigns it to a pool or assigns an existing one from the pool. The before and after checkout callback actually wraps verify.

Note, the behavior is the same in 5.1.x, 5.2.x, 6.0.x, 6.1.x but the code snippets come from: https://github.com/rails/rails/blob/v6.0.4/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb

Therefore, there is no way to instrument diagnostic code BEFORE the actual checkout occurs.

On my fyre infra node, I noticed there was already an nfs PV for the registry storage and I couldn’t figure out how to export a new nfs properly so I just copied it.
[root@jrafanie-inf data]# cat ~/image-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: registry-storage
spec:
capacity:
storage: 200Gi
* Install go
brew install go@1.13
echo 'export PATH="/usr/local/opt/go@1.13/bin:$PATH"' >> ~/.zshrc
export PATH="/usr/local/opt/go@1.13/bin:$PATH"
go version
* Install the operator-sdk:
(Note, redhat laptop is using operator-sdk 0.19.3, go, 1.13 and bin/build works but the operator-sdk generate commands were not tested)
@jrafanie
jrafanie / worker_deployment_inheritance_path.txt
Created December 11, 2020 14:51
Mapping Worker Classes, Openshift deployment names and settings inheritance path.
irb(main):021:0> MiqWorker.descendants.each {|w| puts "Class: #{w.name.ljust(80)} Deployment: #{w.new.worker_deployment_name.ljust(50)} Advanced settings: #{w.path_to_my_worker_settings}"}; nil
Class: MiqUiWorker Deployment: 1-ui Advanced settings: [:worker_base, :ui_worker]
Class: MiqQueueWorkerBase Deployment: 1-queue-worker-base Advanced settings: [:worker_base, :queue_worker_base]
Class: MiqCockpitWsWorker Deployment: 1-cockpit-ws Advanced settings: [:worker_base, :cockpit_ws_worker]
Class: MiqRemoteConsoleWorker Deployment: 1-remote-console Advanced settings: [:worker_base, :remote_console_worker]
Class: MiqSch
@jrafanie
jrafanie / how_to_even_replication_in_pods.txt
Created October 1, 2020 20:44
How to enable replication in ManageIQ with postgresql 12... should work with pg 10/11 also
How to setup replication in pods with postgresql 12 (very similar to 10):
1) Do the following steps for each region: example: 99 for global, 1 for region
In your local manageiq-pods repo, modify the deploy/crds/manageiq.org_v1alpha1_manageiq_cr.yaml with this information:
...
spec:
applicationDomain: <unique name>
postgresqlImageName: <user/repository_of_pg_12_image such as 'jrafanie/postgresql'>
postgresqlImageTag: <tag such as 'latest'>
@jrafanie
jrafanie / deployment_check.rb
Last active August 11, 2020 21:43
pod_deployment_checker
Thread.abort_on_exception = true
STDOUT.sync = true
STDERR.sync = true
module DeploymentCheck
def watch_pod_options
{
:label_selector => "app=manageiq",
:namespace => my_namespace,
# :label_selector => "app=manageiq,worker=true"
@jrafanie
jrafanie / clean_notification_options.rb
Created June 28, 2019 21:22
Hacky fix for rails 5.0.0-5.0.6 bloated serialized notification options with no longer existing constants causing bugs in rails 5.1
require_relative 'config/environment'
Notification.includes(:subject).all.each do |n|
begin
# Options could have no longer available activerecord/activemodel classes from rails 5.0.0 -> 5.0.6, which will raise an ArgumentError on deserialization
# Fixing these to use 5.0.7+ smaller serialization format without all the private attributes is too hard, especailly since you can only read their YAML strings
# and make changes as a string, not as a Hash.
opts = n.options
rescue ArgumentError
new_value = n.subject.try(:name) || n.subject.try(:description)