Skip to content

Tsuchimikado/shikimori

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Contributing

Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help!

Please follow the contribution guidelines.

Requirements

OSX or Linux

PostgreSQL >= 9.6, Ruby >= 2.6, NodeJS >= 10.0, Memcached, Redis

Issues Board (Agile Season)

https://agileseason.com/shared/boards/a98d1565b276f3781070f0e74a7ffcf1

PostgreSQL

DB

psql -d postgres
postgres=# create user shikimori_production;
postgres=# create user shikimori_test;
postgres=# alter user shikimori_production createdb;
postgres=# alter user shikimori_test createdb;
postgres=# alter user shikimori_production with superuser;
postgres=# alter user shikimori_test with superuser;

Create databases

rails db:create

Extensions

psql -d shikimori_test
shikimori_test=# CREATE EXTENSION unaccent;
shikimori_test=# CREATE EXTENSION hstore;
shikimori_test=# CREATE EXTENSION pg_stat_statements;
psql -d shikimori_production
shikimori_production=# CREATE EXTENSION unaccent;
shikimori_production=# CREATE EXTENSION hstore;
shikimori_production=# CREATE EXTENSION pg_stat_statements;

Restore from a backup

rails db:drop && rails db:create
psql -U shikimori_production -d shikimori_production -f db/dump.sql
RAILS_ENV=test rails db:schema:load
rake db:migrate

Make a backup

pg_dump -c shikimori_production > db/dump.sql

Local Run

Requirements

Checkout all projects

git clone [email protected]:shikimori/shikimori.git
git clone [email protected]:shikimori/neko-achievements.git
git clone [email protected]:shikimori/camo-server.git
git clone [email protected]:shikimori/faye-server.git

cd shikimori

Install yarn and honcho (OSX)

brew install yarn
brew install honcho # https://github.com/nickstenning/honcho

Install dependent gems and npm packages

yarn install
bundle install

Start all services

honcho start

Autorun rspec & rubocop

guard

Elasticsearch

In rails console:

pry(main)> AnimesIndex.reset!
pry(main)> MangasIndex.reset!
pry(main)> RanobeIndex.reset!
pry(main)> PeopleIndex.reset!
pry(main)> CharactersIndex.reset!
pry(main)> ClubsIndex.reset!
pry(main)> CollectionsIndex.reset!
pry(main)> UsersIndex.reset!
pry(main)> TopicsIndex.reset!

Update neko rules

rails neko:update

Add new video hosting

# app/services/video_extractor/player_url_extractor.rb

Webpack debugger

https://nodejs.org/en/docs/inspector/ Install the Chrome Extension NIM (Node Inspector Manager): https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj

~ RAILS_ENV=development NODE_ENV=development NODE_PATH=node_modules node --inspect node_modules/.bin/webpack-dev-server --progress --color --config config/webpack/development.js

Webpack visualizer

https://chrisbateman.github.io/webpack-visualizer/

Dependabot

@dependabot ignore this dependency

Move data from development to production

user = User.find(215190);

File.open('/tmp/z.json', 'w') do |f|
  f.write({
    user: user,
    user_preferences: user.preferences,
    style: user.style,
    user_history: UserHistory.where(user_id: user.id),
    user_rates: UserRate.where(user_id: user.id)
  }.to_json);
end;
scp /tmp/z.json devops@shiki_web:/tmp/
user_id = 215190;
json = JSON.parse(open('/tmp/z.json').read).symbolize_keys;

UserRate.where(user_id: user_id).destroy_all;
UserHistory.where(user_id: user_id).destroy_all;

UserHistory.wo_timestamp { UserHistory.import(json[:user_history].map {|v| UserHistory.new v }); };
UserRate.wo_timestamp { UserRate.import(json[:user_rates].map {|v| UserRate.new v }); };

User.wo_timestamp { v = User.new json[:user]; v.save validate: false }
UserPreferences.wo_timestamp { v = UserPreferences.new json[:user_preferences]; v.save validate: false }
Style.wo_timestamp { v = Style.new json[:style]; v.save validate: false }

User.find(user_id).touch

Packages

No packages published

Languages

  • SQLPL 60.9%
  • Ruby 28.4%
  • HTML 5.0%
  • CSS 2.5%
  • CoffeeScript 1.6%
  • JavaScript 1.4%
  • Vue 0.2%