Skip to content
mmx edited this page Dec 7, 2018 · 16 revisions

Requirements

  • npm
  • yarn
  • webpack
  • mysql
  • Redis
  • Elasticsearch (optional)

Download

  • Clone the git repo
git clone https://github.com/maxivak/rails-base-app
  • or download from github

Git

edit .gitignore to include folders and files you don't want to have in remote repository.

Secrets.yml

create secrets.yml and set:

  • secret_key_base - random string
  • db connection (db, db_user, db_password)
  • http authentication if you want to close this version by password (admin_pwd)

see secrets.example.yml for example.

# config/secrets.yml


development:
  secret_key_base: YourKeyHere
  devise_secret_key: another_key_for_devise

  db_host: localhost
  db_name: my_db_name
  db_user: root
  db_password:


test:
 ..


beta:
  secret_key_base: YourKeyHere
  devise_secret_key: another_key_for_devise

  admin_pwd: betapass
  
  db_host: localhost
  db_name: test_my_cms_tpl
  db_user: root
  db_password: "dbpwd"


production:
  secret_key_base: YourKeyHere
  devise_secret_key: another_key_for_devise


  db_host: localhost
  db_name: my_db_name
  db_user: dbu
  db_password: "somepwd"


  • secret keys can be generated with:
rails secret

Import database

  • import database
rake optimacms:install:import_db

it will load database dump from file __db/init.sql

  • load dump from custom sql file
filename=path/to/my/file.sql rake optimacms:install:import_db

! NOTE ! it will delete all existing data in the database.

Install assets with webpack

  • run
rake optimacms:install:assets

it will copy packages and assets for OptimaCMS.

General settings

  • set your app name
# config/initializers/preferences.rb

#
Rails.application.config.SITE_NAME = 'myapp'

Change admin password

rake optimacms:users:set_password['admin','newpassword']
  • or remove default admin user
rake optimacms:users:remove['admin']
  • create a new admin user
rake optimacms:users:create_admin_user['admin','admin@mysite.com','mypwd1234']

install packages

  • install ruby gems
bundle install
  • install packages with yarn
yarn install

Precompile assets

bundle exec rails webpacker:compile

or

rails assets:precompile

Run application

  • run the site in development

Access site

Access site in development:

http://localhost:3000

admin area:

http://localhost:3000/admin

Deployment

  • edit config/deploy.rb and files in config/deploy directory.

  • Read this about deployment.

Application data

Sync application data with remote storages - read deploy.

Settings

Read settings

Clone this wiki locally