Docker setup encapsulates all necessary server side infrastructure, including Elasticsearch DB setup & migrations. The following commands provide all-included setup:
docker-compose build
to make an imagedocker-compose up
to create and run the end containerCommands should be run in the project root folder. And this folder should be a Docker shared resource. Also, Elasticsearch DB requires > 2Gb RAM, a Docker memory limit setting should satisfy this requirement (4Gb seem to be enough).
If this is done without errors, the result should be available on http://localhost:3000/.
As an alternative, the production server can be installed and run "as is", without Docker. This is the way the production server runs in the remote environment. And this can be used for the server application development. The following instructions should be accomplished once:
npm install
- install client app dependenciesnpm run build
- build client appcd ./prod
- go to server foldernpm install
- install nodejs dependenciescd ../
- go to the project root foldernpm run db-migrate
- reset the databaseNow the server can work locally:
cd ./prod
- go to server foldernode server.js
The following should be accomplished once:
npm install
- install client app dependenciesProduction server must be accessible on 3000 port. If it works, the client application can be run via
npm run dev-server
- run the client app in the development mode on 5000 portIf the production server is expected to be run "as is" (without Docker), the following command allows to join both processes in a single one:
npm start
-- run both development (5000) and production (3000) servers concurrently (instead of npm run dev-server
and node server.js
in the "prod" folder)After the development is done, the production version of the client app should be built via npm run build
.
OR
Need to set some options
script.inline: on
script.engine.groovy.inline.aggs: on
path.repo: ["/path_to_backups"]
Following https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html
curl -XPUT 'http://localhost:9200/_snapshot/my_backup' -H 'Content-Type: application/json' -d'
{
"type": "fs",
"settings": {
"location": "my_backup",
"compress": true
}
}'
Then "my_backup" folder should appear in "/path_to_backups" folder (/path_to_backups/my_backup). If not (permission issue?), create it manually.
curl -XGET 'http://localhost:9200/_snapshot/my_backup'
curl -XPUT 'http://localhost:9200/_snapshot/my_backup/snap1' {
"indices": "dharmadict",
"ignore_unavailable": true,
"include_global_state": false
}
This will create "/path_to_backups/my_backup/snap1" folder and fill it up with elastic snapshot data.
curl -XGET 'http://localhost:9200/_snapshot/my_backup/snap1'
curl -XPOST 'localhost:9200/dharmadict/_close?pretty'
curl -XPOST 'localhost:9200/_snapshot/my_backup/snap1/_restore?pretty' -H 'Content-Type: application/json' -d'
{
"indices": "dharmadict",
"ignore_unavailable": true
}