Skip to content

Instantly share code, notes, and snippets.

@mankind
Created July 26, 2021 16:32
Show Gist options
  • Save mankind/b686f12691d0ed9649fa25141c6934d0 to your computer and use it in GitHub Desktop.
Save mankind/b686f12691d0ed9649fa25141c6934d0 to your computer and use it in GitHub Desktop.
Setting up Hyku Addons Account

Setting up Hyku Addons from scratch

Deleting existing system

If already exists and you want to start fresh DANGER: This will kill it all including data

docker-compose down
docker-compose system prune
docker rm -f (docker ps -a -q)
docker volume rm (docker volume ls -q)

Setup

Bundle:

bundle install

You may see an error with Zookeeper not being installed correctly. On Linux, the fix for this is:

CFLAGS=-Wno-error=format-overflow  gem install zookeeper -v ‘1.4.11’ --source ‘https://rubygems.org/’

In order to access the super-admin host as well as the normal tenants, you will need to add them to your /etc/hosts. This will depend on what your tenants cname's are, however an example host file might look like this:

127.0.0.1       localhost
::1             localhost

# Hyku
127.0.0.1       hyku.docker # Required for the super admin to work
127.0.0.1       repo.hyku.docker # One of the tenants for this instantion
127.0.0.1       anschutz.hyku.docker # Another tenant

Please note, you will have to use the :3000 to access the tenants, as you would for any normal Rails app: http://hyku.docker:3000/

Docker Compose Up and allow debugging (via byebug)

docker-compose up -d web workers; docker attach hyku_addons_web_1

Enter bash inside container

docker-compose exec web /bin/bash

Create a Super Admin

bundle exec rails app:hyku_addons:superadmin:create

Create an account

Via app interface

Goto the accounts screen http://hyku.docker:3000/proprietor/accounts?locale=en

Via console

Goto the console

docker-compose exec web bundle exec rails console

Copy the string returned from secure random for use as the account UUID

SecureRandom.uuid

Run the following:

# bundle exec rails "app:hyku:account:create[Name, Copied UUID, CNAME, Email from above]"
 docker-compose exec web bundle exec rails "app:hyku:account:create[test, aa070467-09d7-4b13-bb5a-7192f900e6c3, test.hyku.docker, [email protected]]"

Activate user

Your user will need to be activated as invitations are not sent locally

docker-compose exec web bundle exec rails console
AccountElevator.switch!(Account.first.cname)

# NOTE: The password is being set again as it doesn't seem to be correct when trying to login
User.first.update(invitation_token: nil, invitation_accepted_at: DateTime.current, password: 'test1234')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment