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.
-
Clone the Repository
git clone https://github.com/berkmancenter/brkmn.git cd brkmn
-
Set Up Docker
Launch the services using Docker Compose:
docker-compose up
-
Access the App Container
Open a bash session in the app container:
docker-compose exec app bash
-
Install Dependencies
Inside the container, run:
bundle install yarn install
-
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 |
-
Database Setup
Run database migrations:
rails db:migrate
-
Start the Application
Use the following command to start the app in development mode:
./bin/dev
Run the test suite using:
bundle exec rspec
Follow the development setup steps above to initialize your environment. Ensure that ALLOWED_HOSTS
is set to the server hostname.
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
- Dan Collis-Puro: djcp@cyber.law.harvard.edu
- Flavio Giobergia: flavio.giobergia@studenti.polito.it
- Andromeda Yelton: ayelton@cyber.harvard.edu
- Peter Hankiewicz: peter.hankiewicz@gmail.com
Brkmn is open-source software licensed under the MIT License. For more information, visit MIT License.
© 2012 President and Fellows of Harvard College