Skip to content

dneslov is a diary calendar containing the name of orthodox christian feasts and saints celebs

Notifications You must be signed in to change notification settings

znamenica/dneslov

Repository files navigation

README

This README would normally document whatever steps are necessary to get the application up and running.

Status

Homepage Website dneslov.org GitHub GitHub tag Open Source? Yes! GPLv2 license Build Status Build Status Codacy Badge Code Climate Test Coverage PRs Welcome Telegram

Installation

Requirements

List of the requirements (packages are named as in ALT conventions) are the following: 0. gcc-c++

  1. libhiredis-devel
  2. libsnappy-devel
  3. libruby-devel
  4. redis
  5. xclip
  6. sidekiq
  7. postgresql15-server-devel
  8. postgresql15-server
  9. postgresql15-contrib
  10. libwebp-tools
  11. libImageMagick-devel
  12. curl
  13. git
  14. sudo
  15. node
  16. yarn
  17. gostsum

If you have an ALT installation, just install requirements by single line:

apt-get install libhiredis-devel libsnappy-devel redis xclip sidekiq postgresql15-server-devel postgresql15-server postgresql15-contrib libwebp-tools curl git sudo node yarn gostsum libImageMagick-devel

It any others, just correlate them for each of packages to your system's ones, and then install as usually.

Prerequisites

  1. Setup RVM: 1.1. Import gpg records if required:
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

1.2. Install rvm itself as follows:

\curl -sSL https://get.rvm.io | bash -s stable

1.3. Make sure taht .bashrc has rvm setup lines:

grep rvm ~/.bashrc
export PATH="$PATH:$HOME/.rvm/bin"

1.4. Relogin into the shell.

  1. Install required ruby

Get into the projects folder, then run:

rvm install ruby-$(cat Gemfile|grep ^ruby|sed "s,.*'\([0-9.]\+\)'.*,\1,")

This will install projects ruby into the system.

  1. Create required config files secrets.yml, and database.yml, and .env

dneslov/shared/config/database.yml

development:
  adapter: postgresql
  encoding: unicode
  database: dneslov_development
  pool: 5
  username: dneslov
  password: 

dneslov/shared/config/secrets.yml

production:
   secret_key_base: <secret hash>

dneslov/shared/.env

---
github:
   client:
      id: "..."
      secret: "..."
   access_token_url: "https://github.com/login/oauth/access_token"
   user_info_url: "https://api.github.com/user"
   client_url: "https://dneslov.org/dashboard"
   redirect_url: "https://dneslov.org/auth/github"
secret_key_base: '...'
jwt_secret: "..."
sentry:
   dsn: "https://...@....ingest.sentry.io/..."
rails:
   resque:
      redis: "localhost:6379"
redis:
   url: "redis://localhost:6379"

Deployment

Sudo

Setup sudo for deployment if required.

Setup

Setup deployment, and remote restart can be done for production or staging environment, it is no meaning to do this for development. So these three steps can be skipped.

Run capistrano setup task:

$ cap production setup

Deploy

$ cap production deploy

Deploy with a server restart

$ cap production deploy deploy:restart

Remote server restart

$ cap production deploy:restart

Development server start

In development mode:

Run server and file watcher with:

RAILS_ENV=development foreman start -f config/procfiles/development.rb -d .

Tasks

Image Synchronisation

On client side proceed images into to upload-ready format, so do:

rake dneslov:image:proceed[~/Документы/Изображения/dneslov_pin1/,~/Документы/днеслов/upimages]

Then rsync them with the upload server(s):

rake dneslov:image:rsync[~/Документы/днеслов/upimages,~/git/dneslov/public/images:~/git/dneslov/public/images1]

Then on server side from mouted upstream server load images as resources, and then converts them into icon or thumb links, as:

rake dneslov:load:resources[/mnt/mail] dneslov:load:images[/images]

API

Request for all licit calendaries:

curl -k "https://dneslov.org/api/v1/calendaries.json"

Paged version with 10 records per page:

curl -k "https://dneslov.org/api/v1/calendaries.json?page=1&per=10"

Request for all licit calendaries with ones unlicit, which are specified by slug:

curl -k "https://dneslov.org/api/v1/calendaries.json?c=гпц&page=1&per=10"

Tasks

PDF Generation

To generate PDF calendary with a first record per day, use the following:

rake book:pdf[днеслов.pdf,днеслов]