Skip to content

Rud5G/gumroad

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gumroad logo

Sell your stuff. See what sticks.

LicenseCode of ConductContributing

Table of Contents

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

Ruby

Node.js

Docker & Docker Compose

We use docker and docker compose to setup the services for development environment.

  • For MacOS: Grab the docker mac installation from the Docker website
  • For Linux:
sudo wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)

MySQL & Percona Toolkit

Install a local version of MySQL 8.0.x to match the version running in production.

The local version of MySQL is a dependency of the Ruby mysql2 gem. You do not need to start an instance of the MySQL service locally. The app will connect to a MySQL instance running in the Docker container.

  • For MacOS:
brew install [email protected] percona-toolkit
brew link --force [email protected]

# to use Homebrew's `openssl`:
brew install openssl
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"

# ensure MySQL is not running as a service
brew services stop [email protected]

Image Processing Libraries

ImageMagick

We use imagemagick for preview editing.

  • For MacOS: brew install imagemagick
  • For Linux: sudo apt-get install imagemagick
libvips

For newer image formats we use libvips for image processing with ActiveStorage.

  • For MacOS: brew install libvips
  • For Linux: sudo apt-get install libvips-dev

FFmpeg

We use ffprobe that comes with FFmpeg package to fetch metadata from video files.

  • For MacOS: brew install ffmpeg
  • For Linux: sudo apt-get install ffmpeg

PDFtk

We use pdftk to stamp PDF files with the Gumroad logo and the buyers' emails.

  • For MacOS: Download from here
  • For Linux: sudo apt-get install pdftk

Installation

Bundler and gems

We use Bundler to install Ruby gems.

gem install bundler

If you have a license for Sidekiq Pro, configure its credentials:

bundle config gems.contribsys.com <key>

If you don't have a license for Sidekiq Pro, set the environment variable GUMROAD_SIDEKIQ_PRO_DISABLED in your shell:

export GUMROAD_SIDEKIQ_PRO_DISABLED=true
echo "export GUMROAD_SIDEKIQ_PRO_DISABLED=true" >> ~/.bashrc

Run bundle install to install the necessary dependencies.

Also make sure to install dotenv as it is required for some console commands:

gem install dotenv

npm and Node.js dependencies

Make sure the correct version of npm is enabled:

corepack enable

Install dependencies:

npm install

Configuration

Setup Custom credentials

App can be booted without any custom credentials. But if you would like to use services that require custom credentials (e.g. S3, Stripe, Resend, etc.), you can copy the .env.example file to .env and fill in the values.

Local SSL Certificates

  1. Install mkcert on macOS:
brew install mkcert

For other operating systems, see mkcert installation instructions.

  1. Generate certificates by running:
bin/generate_ssl_certificates

Running Locally

Start Docker services

If you installed Docker Desktop (on a Mac or Windows machine), you can run the following command to start the Docker services:

make local

If you are on Linux, or installed Docker via a package manager on a mac, you may have to manually give docker superuser access to open ports 80 and 443. To do that, use sudo make local instead.

This command will not terminate. You run this in one tab and start the application in another tab. If you want to run Docker services in the background, use LOCAL_DETACHED=true make local instead.

Setup the database

bin/rails db:prepare

For Linux (Debian / Ubuntu) you might need the following:

  • apt install libxslt-dev libxml2-dev

Start the application

bin/dev

This starts the rails server, the javascript build system, and a Sidekiq worker.

If you know what foreman does and you don't want to use it you can inspect the contents of the Procfile.dev file and run the required components individually.

You can now access the application at https://gumroad.dev.

Development

Logging in

You can log in with the username [email protected] and the password password. The two-factor authentication code is 000000.

Read more about logging in as a user with a different team role at Users & authentication.

Resetting Elasticsearch indices

You will need to explicitly reindex Elasticsearch to populate the indices after setup, otherwise you will see index_not_found_exception errors when you visit the dev application. You can reset them using:

# Run this in a rails console:
DevTools.delete_all_indices_and_reindex_all

Push Notifications

To send push notifications:

INITIALIZE_RPUSH_APPS=true bundle exec rpush start -e development -f

Common Development Tasks

Rails console:

bin/rails c

Rake tasks:

bin/rake task_name

Linting

We use ESLint for JS, and Rubocop for Ruby. Your editor should support displaying and fixing issues reported by these inline, and CI will automatically check and fix (if possible) these.

If you'd like, you can run git config --local core.hooksPath .githooks to check for these locally when committing.

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 73.8%
  • HTML 13.0%
  • TypeScript 12.2%
  • SCSS 0.5%
  • CSS 0.3%
  • Shell 0.1%
  • Other 0.1%