{"id":20635752,"url":"https://github.com/psu-libraries/myaccount","last_synced_at":"2026-05-16T04:19:29.483Z","repository":{"id":36138072,"uuid":"218353897","full_name":"psu-libraries/myaccount","owner":"psu-libraries","description":"My Account - an application for checkouts, renewals, holds and bills","archived":false,"fork":false,"pushed_at":"2025-02-13T15:59:32.000Z","size":2611,"stargazers_count":0,"open_issues_count":19,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-02-13T16:43:31.715Z","etag":null,"topics":["ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/psu-libraries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-29T18:17:36.000Z","updated_at":"2025-02-13T15:59:33.000Z","dependencies_parsed_at":"2023-11-13T19:30:32.240Z","dependency_job_id":"a3371da1-6e3f-43a8-9d8b-5d2de55acdf5","html_url":"https://github.com/psu-libraries/myaccount","commit_stats":null,"previous_names":[],"tags_count":71,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psu-libraries%2Fmyaccount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psu-libraries%2Fmyaccount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psu-libraries%2Fmyaccount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/psu-libraries%2Fmyaccount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/psu-libraries","download_url":"https://codeload.github.com/psu-libraries/myaccount/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242650955,"owners_count":20163611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby-on-rails"],"created_at":"2024-11-16T15:07:08.444Z","updated_at":"2026-05-16T04:19:29.475Z","avatar_url":"https://github.com/psu-libraries.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![\u003cpsu-libraries\u003e](https://circleci.com/gh/psu-libraries/myaccount.svg?style=svg)](\u003chttps://circleci.com/gh/psu-libraries/myaccount\u003e)\n# Setup Your Environment:\n\n## Mac\n\n* Get `homebrew` installed and configured using [these instructions](https://brew.sh)\n* Get `homebrew` installed and configured using [these instructions](https://brew.sh)\n* `ruby` via `rbenv` ([Upgrading Ruby Version Using rbenv](https://github.com/psu-libraries/psulib_blacklight/wiki/Upgrading-Ruby-Version-Using-rbenv))\n\n# Dependencies\n\n| Software |  Version |\n|----------|------|\n| `ruby`    |  3.4.1 |\n| `rails`   |  7.1.5 |\n| `redis`   | 5.0.7 |\n\n# Development Setup\n\n1.  [Make sure you have ssh keys established on your machine](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#generating-a-new-ssh-key)\n1.  Clone the application and install:\n    ```\n    git clone git@github.com:psu-libraries/myaccount.git\n    cd myaccount\n    bundle install --without production\n    ```\n1.  Set local environment variables with values from [vault](https://vault.dsrd.libraries.psu.edu:8200/ui/vault/auth?with=oidc%2F)\n1.  Run `yarn`\n1.  Use [Modify Header Value](https://addons.mozilla.org/en-US/firefox/addon/modify-header-value/) browser extension to set the following headers:\n    ```\n    URL: localhost\n    Header Name: X_AUTH_REQUEST_EMAIL\n    Header Value: [access id]@psu.edu\n\n    URL: localhost\n    Header Name: REMOTE_USER\n    Header Value: [access id]\n    ```\n1.  Use one of the following options to run myaccount\n\n\n## Option 1: Redis locally\n\nUse the [redis docker image](https://hub.docker.com/_/redis/).\n\nShould be able to just run it with a command listed in the docker hub page:\n\n`docker run -d -p \u003cREDIS_PORT\u003e:6379 --name redis-the-new-black redis:5.0.7`\n\nThen boot up the rails server with caching turned on and you'll be all set.\n\n `bundle exec rails s --dev-caching`\n\nMonitor the behavior by tailing the logs:\n\n `docker exec -it redis-the-new-black redis-cli monitor`\n\n ### Sidekiq\n\n Sidekiq is also a part of this application, so start it:\n\n ```\n bundle exec sidekiq\n ```\n\n Sidekiq is being used as a means of speeding things up for our end users. This is especially true for large batches of changes being requested and most true for large batches of changes that apply to a single bib (multiple calls). Without the concurrency that Sidekiq provides, these requests would take significantly more time. For example a request to place a hold on 32 volumes might take 106 seconds without Sidekiq and with Sidekiq that comes down to a still long, but much quicker 15 seconds.\n\n Another option could have been hijacking the HTML and sending individual HTTP requests from JavaScript and then handling the response on each in JavaScript as well, but, we feel that this approach is less attractive due to the fact that it's even more complex than the Sidekiq and polling apparatus and seems to work against the intention of a form in HTML rather than with it.\n\n We have also decided to not allow Sidekiq jobs to retry due to failure. This is because we have already built in retries due to expected problems that could occur when attempting to interact with the web service. A retry could potentially be harmful given the immediate response needed by the user.\n\n### Putting it all together\n\nLocally you'll need to run these commands:\n\n```\nbundle exec rails s\ndocker start redis-the-new-black\nbundle exec sidekiq\n```\n\n## Option 2: Docker-compose\nYou can run the whole myaccount stack via docker-compose. This will build a container for myaccount, sidekiq, and run web, sidekiq, and redis services. You will need a SYMWS_PIN to run locally.\n\n1.) copy example .envrc file\n```\ncp .envrc.example .envrc\n```\n2.) edit and source the .envrc file\n\n```\nsource .envrc\n# optionally if you have direnv this is done for you for free\n# https://direnv.net/\n```\nOnce the configuration is set, you can start developing.\n\n### Common Tasks\nStart Up myaccount and start developing\n\n```\ndocker-compose up --build -d\n```\n\nGet a shell into the myaccount container\nreplace \"web\" with \"test\" or \"sidekiq\" to get a shell into those services\nHere you can run any linting, or tests that you normally run locally. i.e updating your bundle etc.\n```\ndocker-compose exec web bash\n```\n\nRestart a container\n```\ndocker-compose restart web\n```\n\nRun tests\n```\ndocker-compose run test bundle exec rspec \u003cpath to file\u003e\n# we've wrapped this into a helper script\n./bin/test \u003cpath to spec\u003e\n\n# or to run all specs\n./bin/test\n```\n\n\nVolumes: Sometimes you may want to remove a volume you can easily remove all volumes with the follwowing commmand, they will get re-created when you do an up\n```\ndocker-compose down -v\n```\n\nRun a one off command\n```\ndocker-compose exec web bundle\n```\n\nAttach to the running container\nIf you want to do byebug, or pry you can attach your current session into the running container\nA Ctrl+C in this window will halt the web process, you can reload it by running\n`docker-compose restart web`\n```\n./bin/attach\n```\n\nStop developing for the day, and go home!\n```\ndocker-compose down\n```\n\nChange the Redis, or App Port\nIf you're running redis locally for another project, or you are running another rails project, you may need to change the port that's exposed for myaccount\n\n```\necho \"export REDIS_PORT=9999\" \u003e\u003e .envrc\necho \"export APP_PORT=3001\" \u003e\u003e .envrc\nsource .envrc\ndocker-compose up -d\n```\nNow, myaccount redis will be exposed on port 9999, and myaccount will be exposed on port 3001.\n\n\n# Terminology\n\nThere is a lot of domain terminology that can be confusing. Here are some of the bigger things to keep in mind:\n\n* _Bib_ - a bibliographic container that holds calls and items, contains global information about the bibliographic record described like author and title which is the same throughout the entire record (p.s., bibs can be *large*).\n* _Call_ - a call number based container that contains items and is contained within a bib. There can be multiple calls in a bib. There can be multiple items in a call.\n* _Item_ - info that describes the thing that is actually held or checked out. Has a barcode and checkout status.\n\nThis is an attempt at a quick and rough \"[ubiquitous language](https://martinfowler.com/bliki/UbiquitousLanguage.html)\"\n\n# CI\nWe use Circle CI to test myaccount. In the event of a test failure you can visit \u003chttps://circleci.com/gh/psu-libraries/myaccount\u003e to see the jobs output. You can gain shell access to the build by choosing \"Rerun with SSH\" once logged in, your code will be checked out at the `/project` path.\n\n# Healthcheck endpoint `/health`\n\n* Uses OkComputer to help with writing healthchecks. The convention for healthchecks is as follows:\n  * https://myaccount-okcomputer.dev.k8s.libraries.psu.edu/health - shows the application health (is rails started ok?)\n  * https://myaccount-okcomputer.dev.k8s.libraries.psu.edu/health/all - shows all registered health checks in the system\n  * https://myaccount-okcomputer.dev.k8s.libraries.psu.edu/health/{check_name} - shows an indiviual check. for example, https://myaccount-okcomputer.dev.k8s.libraries.psu.edu/health/version -- to emit the version that's running\n* The current checks are default, version, redis, and all.\n* You can also tack on .json to the routes to get a machine readable version of the healthcheck. i.e. https://myaccount-okcomputer.dev.k8s.libraries.psu.edu/health/all.json\n\n# Config gem and environment variables\n\nYou can use either the yml file inheritance structure inherent to the config gem, or you can set environment variables. See [\"Working with Environment Variable\"](https://github.com/rubyconfig/config#working-with-environment-variables).\n\nWhen changing these values you must restart the web server (passenger) _and_ sidekiq. Run `/bin/systemctl restart sidekiq` and  `passenger-config restart-app` on the server where the change is being applied. Locally just stop and start these again.\n\n## Overriding pickup location labels\n\nPickup locations for holds placed are manually dictated by Lending and Reserves Services. Meaning, that although the Symphony system does have the ability to automate this and could be deriven from web service calls we do not do this (for reasons). The workflow is: they tell us what they want for the labels and we add them in `settings.yml`. This means we can override them as needed too by following the inheritance flow of the `config` gem. For production we use `production.local.yml` to override these values. Note that `Settings.pickup_locations` does _not_ affect the labels used in displaying the \"Pickup at\" column in the holds tables. That is currently not overridable.\n\n*Knockout prefix* - because we sometimes need to remove only certain keys in a Hash stored in settings we need to make use of the [`knockout_prefix`](https://github.com/rubyconfig/config#merge-customization) feature in the Config gem. The override of the Hash goes like this:\n\n1. Defined initially in settings.yml and tracked in repo\n1. Overridden to be knocked out in settings.local.yml (i.e., `pickup_locations: --`)\n1. Overridden again to be redefined in `settings/production.local.yml` without the keys that are meant to be removed\n\n## Modifying announcement bar\n\n1. Defined initially in settings.yml and tracked in repo\n1. Overridden in settings.local.yml\n\n```rb\nshow_announcement: true\nannouncement:\n  # See https://fontawesome.com/icons\n  icon: fa-exclamation-circle\n  message: All University Libraries locations are closed, but we're here to help! See \u003ca href=\"https://libraries.psu.edu/covid19\"\u003e University Libraries COVID-19 (novel coronavirus) Updates and Resources\u003c/a\u003e for more information.\n  # See https://getbootstrap.com/docs/4.4/utilities/colors/\n  html_class: bg-warning\n```\n\nIf one of the special keys isn't present, there is no ill-effect. It is just not there and the system operates as per usual. If the announcement array isn't present, then the default announcement in the translation file will show.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsu-libraries%2Fmyaccount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpsu-libraries%2Fmyaccount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpsu-libraries%2Fmyaccount/lists"}