It's a content management platform in Ruby on Rails.
- bundle install problem: mysql.h is missing solve : http://stackoverflow.com/questions/5919727/bundle-install-problem-mysql-h-is-missing
-
Nginx not auto start-up problem => port 80 blocked by apache2 by default, see 'ps ax | grep apache2' => modify /etc/apache2/ports.conf and delete /etc/apache2/sites-enabled/000-default => 'sudo update-rc.d nginx defaults' to add service to auto-start list => if do not want to reboot, kill apache process by 'sudo kill -9 ' then 'sudo service nginx start'
-
Sidekiq auto start-up # (X: not yet success ...) => download sidekiq.conf & workers.conf from 'https://github.com/mperham/sidekiq/tree/master/examples/upstart' => move them to '/etc/init.d/sidekiq' & '/etc/init.d/workers', then 'sudo update-rc.d _____ defaults'
sidekiq # start sidekiq, or 'bundle exec sidekiq ... -L log/sidekiq.log &', add 'xvfb-run' in front while at cloud server, see part 3 whenever -i # reload scheduled task settings crontab -e # edit unix cron-tab for scheduled tasks config in config/sidekiq.yml & config/schedule.rb
- Job queue but not processed => sidekiq haven't start.
- Job failed => user password error / wordpress json-api create-post not enabled / db host not grant access /
- Redis-server has not enabled / check by 'redis-cli ping'
- try flushall redis-cli keys, or directly edit crontab, remove unused one.
- add in config/schedule.rb => set :job_template, "bash -l -i -c ':job'"
- don't leave any 'puts' in background script, will cause error while no login shell.
sudo apt-get install libqt4-dev libqtwebkit-dev
sudo apt-get install xvfb libicu48
than add this lin 'export DISPLAY=localhost:1.0' in ~/.bash_profile and start any command need display session by 'xvfb-run'
Ex: 'xvfb-run bundle exec sidekiq ... -L log/sidekiq.log &'
####[MONGOID database] [Dump selected database in current path] mongodump --db <db_name>
[Drop database to clean all] mongo <db_name> --eval "db.dropDatabase()"
[Recover selected database from assigned path] mongorestore --db <db_name> ./dump/<db_name>/
[REDIS database] Dump redis all (need Gem redis-dump) redis-dump > ./dump/<db_name>_redis.json
Clean all redis-cli flushall
Restore from json cat ./dump/<db_name>_redis.json | redis-load
[Redis on MAC] To have launchd start redis at login: ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents Then to load redis now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist Or, if you don't want/need launchctl, you can just run: redis-server /usr/local/etc/redis.conf