Skip to content

Running Greasy Fork locally

Jason Barnabe edited this page Feb 9, 2024 · 31 revisions

Greasy Fork is a Ruby on Rails site running on puma/nginx. This method will first describe how to only deploy the Rails portion of the code using the built-in Rails web server.

Prerequisites

Pull the code

The regular GitHub way.

Gem installation

From the Greasy Fork directory:

  • Install bundler - gem install bundler
  • Install required gems - bundle install

MariaDB setup

Start MariaDB log in as root, and run:

CREATE USER 'yourmysqlusername'@'localhost' IDENTIFIED BY 'yourmysqluserpassword';
CREATE SCHEMA greasyfork;
GRANT ALL ON greasyfork.* TO 'yourmysqlusername'@'localhost';
CREATE SCHEMA greasyforktest;
GRANT ALL ON greasyforktest.* TO 'yourmysqlusername'@'localhost';

Now run mysql -uyourmysqlusername -p greasyfork < db/structure.sql. This gives you a blank site.

Secret files

Files with passwords and such.

config/database.yml

development:
  adapter: mysql2
  database: greasyfork
  username: yourmysqlusername
  password: yourmysqlpassword
  host: 127.0.0.1
  port: '3306'
  encoding: utf8mb4
  collation: utf8mb4_unicode_ci

test:
  adapter: mysql2
  database: greasyforktest
  username: yourmysqlusername
  password: yourmysqlpassword
  host: 127.0.0.1
  port: '3306'
  encoding: utf8mb4
  collation: utf8mb4_unicode_ci

Fire it up

  • rake ts:configure - configure Sphinx
  • indexer -c config/development.sphinx.conf --all - build sphinx index
  • rake ts:start - start Sphinx
  • rails server - start the web server
  • Go to http://localhost:3000/

Need help?

This was written from memory and likely has errors and omissions. Please file a ticket or ask in the forum for help.