/brkmn

The dirt-simple URL shortener at brk.mn

Primary LanguageRubyMIT LicenseMIT

brkmn

Build Status

brkmn is a dirt-simple URL shortener designed to make sharing links a breeze. Powered by Ruby on Rails and PostgreSQL, it's a robust solution for managing and shortening URLs with ease.

Getting Started

Development Setup

  1. Clone the Repository

    git clone https://github.com/berkmancenter/brkmn.git
    cd brkmn
  2. Set Up Docker

    Launch the services using Docker Compose:

    docker-compose up
  3. Access the App Container

    Open a bash session in the app container:

    docker-compose exec app bash
  4. Install Dependencies

    Inside the container, run:

    bundle install
    yarn install
  5. Configure Environment Variables

    Copy the example environment configuration file and edit as necessary:

    cp .env.example .env

    Add or update the following variables in your file:

Environment Variable Description Default Value
DATABASE_USERNAME The username used for accessing the database. None
DATABASE_PASSWORD The password associated with the database username. None
DATABASE_DB_NAME The name of the database to which the application connects. None
DATABASE_HOST The hostname where the database is hosted. None
DATABASE_PORT The port number for the database connection. 5432
DATABASE_TIMEOUT The timeout setting for database connections, in milliseconds. 5000
USE_FAKEAUTH Set to true to bypass CAS authentication for development purposes. None
SECRET_KEY_BASE Required in production. Generate using rails secret. None
ALLOWED_HOSTS Comma-separated list or regex of allowed hosts. localhost
CAS_DATA_DIRECTORY Directory for storing CAS data. Used if USE_FAKEAUTH is set during development. None
FOOTER_TEXT Footer text displayed in the application. None
SIDEKIQ_CONCURRENCY Specifies the number of threads Sidekiq uses to process jobs. Falls back to RAILS_MAX_THREADS or 5. 5
RAILS_MAX_THREADS Specifies the maximum number of threads for the Rails server. Used if SIDEKIQ_CONCURRENCY is not set. None
  1. Database Setup

    Run database migrations:

    rails db:migrate
  2. Start the Application

    Use the following command to start the app in development mode:

    ./bin/dev

Testing

Run the test suite using:

bundle exec rspec

Deployment

First-Time Setup

Follow the development setup steps above to initialize your environment. Ensure that ALLOWED_HOSTS is set to the server hostname.

Regular Deployment

For each deployment, execute the following:

git pull
bundle install
yarn install

If you have made changes to assets, run:

rails assets:clobber && rails assets:precompile

If there are database schema changes, execute:

rails db:migrate

Finally, restart your application:

touch tmp/restart.txt

Contributors

License

Brkmn is open-source software licensed under the MIT License. For more information, visit MIT License.

Copyright

© 2012 President and Fellows of Harvard College