Skip to content

sergey-arkhipov/article

Repository files navigation

README

This is work in process on example Rails 7 app with

  • Rails 7
  • importmap
  • elasticsearch
  • bulma

The application is designed to create articles with the ability to quickly search, edit articles with version storage, quickly create a new version of an article based on an existing one. You can view and delete versions. The application works with the Russian language and supports localization.

Version

  1. ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
  2. Rails 7.0.4
  3. Elasticsearch Version: 8.5.1
  4. Postgres pg_ctl (PostgreSQL) 14.5 (Homebrew)

Configuration

Install elasticsearch

Two ways:

  1. Download and unzip Elasticsearch
  2. brew install elasticsearch

The difference between ways

  1. Current version 8.5.2
  2. Curent version
% brew info elasticsearch
==> elasticsearch: stable 7.10.2 (bottled)
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
Disabled because it is switching to an incompatible license. Check out `opensearch` instead!
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/elasticsearch.rb
License: Apache-2.0

Installation

Install postgress

% brew install postgress

Download app

% git clone [email protected]:sergey-arkhipov/article.git

Install

% cd article
% bundle install

Configure

% vim config/database.yml  #Postgres connect
% vim vim config/initializers/elasticsearch.rb # Elasticsearch config
% vim Procfile # Configure path to elasticsearch

ELASTIC_PASSWORD and CERT_FINGERPRINT required if elasticseach has been installed by first way or you simply preffered secure connection between app and elastic.

% rails db:setup #Create DB, fill with seeds.rb

Run tests

Configure test node elasticsearch

Start the elasticsearch test server http://localhost:9250 If you installed an elasticsearch server with SSL and certificate support, create a separate configuration for the test environment with an anonymous user

Example

# conf_test/elasticsearch.yml
cluster.name: test_rails
node.name: test-node
path.data: $ES_HOME/test_data
path.logs: $ES_HOME/logs_test
http.port: 9250
http.host: 0.0.0.0
xpack.security.authc:
  anonymous:
    username: anonymous
    roles: admins
    authz_exception: true

# conf_test/roles.yml
admins:
  cluster:
  - all
  indices:
  - names: ["*"]
    privileges: [all]
% ES_PATH_CONF=./conf_test ./bin/elasticsearch

Run tests

% ./bin/rails t
% ./bin/rspec --color -f d

About

Rails 7 with elastich search

Resources

Stars

Watchers

Forks

Packages

No packages published