Skip to content

UMN-LATIS/z

Repository files navigation

Z

tests GitHub Release

Z is a custom URL shortener for the University of Minnnesota developed by LATIS. We use Z to create and manage University branded short links, for example: http://z.umn.edu/mycoolsite.

Features

  • Custom or generated link short urls at z.umn.edu
  • QR code generation
  • Click statistics
  • Collections of links
  • Sharing link management between users
  • Integration with University directory
  • Ownership transfer of links
  • Administrative dashboard
  • History of link changes
  • Link creation API

Getting Started

  1. Prep your system for running Ruby and Rails with MySQL

  2. Make sure that config/database.yml is correctly configured with database credentials, and config/ldap.yml is correctly configured with LDAP credentials, and an instance of MySQL is running.

  3. Install the version of ruby in .ruby-version:

    rbenv install
  4. Install dependencies with bundler and yarn

    bundle install # ruby dependencies
    yarn install   # javascript dependencies
  5. Create, import the schema, and seed the database. Part of this connects to LDAP, so you will need to be on UMN VPN.

    # create the database, run migrations, and seed the database
    ./bin/rails db:setup # or ./bin/rails db:reset to drop the exist db first
  6. To launch the application, run:

    ./bin/dev

    This will use foreman to start both Vite (used for VueJS), and Rails.

Connect to [http://localhost:5100].

Testing

In test mode, Rails will use UserLookupServiceSkeleton, a stubbed version of the normal LDAP UserLookupService which will load test users from Cypress fixtures at cypress/fixtures rather than doing a normal LDAP lookup.

To run the unit tests with Rspec:

bundle exec rspec

Cypress is used for End to End testing. To run the tests locally, you will need to have the application running.

You'll want to start the server using UserLookupServiceSkeleton, a stubbed version of the normal LDAP, which will load test user data from Cypress fixtures at cypress/fixtures. This is configured in Procfile.test.

# start the Rails server in test mode wiht user lookup skeleton service stubbed
./bin/foreman start -f Procfile.test

Once the server is running, you can open Cypress with:

# open cypress
yarn cypress open

Deployment

For deployment, we use:

See config/deploy.rb and config/deploy/ for deployment configuration.

Remote Dev and Staging

To deploy remote dev and staging environments:

bundle exec cap <environmentname> deploy
Environment Name Server
remotedev cla-z-dev-02.oit.umn.edu
staging cla-z-tst-02.oit.umn.edu

Production

See Deploying to Production.

After deploying, populate the ip2location_db1 table with the content from the IP2Location LITE IP-Country Database.

Internationalization

Most of the language has been extracted into a single localization file. This allows you to change any language and make Z applicable to your environment.

Contribute