Commit 8347a376 authored by Marcelo Rivera's avatar Marcelo Rivera

Merge remote-tracking branch 'upstream/master' into feat/separate-redis-cache-and-pubsub

parents 56738ac1 0508964a
......@@ -31,4 +31,4 @@ node_modules
!.editorconfig
!.data
!/.gitlab
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "T - Bug" label and verify the issue you're about to submit isn't a duplicate.
--->
### Summary
(Summarize the bug encountered concisely)
### Steps to reproduce
(How one can reproduce the issue - this is very important)
### Platform information
(Browser, device, system stats, screen size)
### What is the current *bug* behavior?
(What actually happens)
### What is the expected *correct* behavior?
(What you should see instead)
### Relevant logs and/or screenshots
(Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)
### Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
/label ~"T \- Bug" ~"S \- Triage:new"
......@@ -14,19 +14,38 @@ Minds is split into multiple repositories:
## Development System Requirements
- > 10GB RAM
- > 10GB RAM (be sure to set it in your docker settings)
- > 100GB Disk space
- [Docker Compose](https://docs.docker.com/compose/)
## Development Installation
**Enabling full installation**
### Setting up elasticsearch
** Linux users **
To get elasticsearch 6 to run, you must make a settings change on the host machine.
Run ```sudo sysctl -w vm.max_map_count=262144```
To make it permanent, modify the variable in /etc/sysctl.conf
#### Build the elasticsearch indexes
1. Make sure nothing is running: `docker-compose down`
2. Run the legacy provisioner: `docker-compose up elasticsearch-legacy-provisioner`
3. Run the legacy provisioner: `docker-compose up elasticsearch-provisioner`
### Running the stack the first time
1. Run `sh init.sh` in order to install the front and engine repositories
2. Run `docker-compose up -d nginx`
3. Run `docker-compose up installer` (one time only.. initial username: minds / password: Pa$$w0rd)
4. Run `docker-compose up front-build`
5. Navigate to `http://localhost:8080`
### Troubleshooting
# Troubleshooting
- Minds is already installed
- Ensure engine/settings.php does not exist and re-run `docker-compose up installer`
......@@ -35,6 +54,33 @@ Minds is split into multiple repositories:
- Ensure thrift is enabled
- Cassandra requires at least 4GB of memory to operate. You can start Cassandra manually by running `docker-compose up cassandra`
### Nuclear Option
With dockerized enviroments, it's sometimes best to start from scratch. If you want to delete your data, these steps will completely **delete** your data. You will be starting fresh.
```
#Remove your settings file
rm engine/settings.php
#Stop your stack
docker-compose down
#Delete your data cache
rm -rf .data
#Purge all volumes
docker volume prune
```
That will remove all of your locally cached data. You can either rebuild the containers manually by using ```docker-compose up --build``` or delete everything to start fresh.
```
# Delete all containers
docker rm $(docker ps -a -q)
```
## Production System Requirements
At this time it is not advisable to run Minds in production, however it is possible so long as you are aware of the risks.
......
#!/bin/bash
rm -rf /usr/share/elasticsearch/data/*
exec /docker-entrypoint.sh elasticsearch
\ No newline at end of file
FROM alpine:latest
RUN apk add curl docker --no-cache
WORKDIR /provisioner
COPY wait-for.sh provision-elasticsearch.sh provision-elasticsearch-legacy.sh /provisioner/
COPY schema-legacy/ /provisioner/schema-legacy/
COPY schema/ /provisioner/schema/
ENTRYPOINT ["sh", "./provision-elasticsearch.sh"]
\ No newline at end of file
#!/bin/bash
echo "Provisioning legacy elastic search";
echo "Waiting for legacy elastic search to come online..."
./wait-for.sh minds_elasticsearch-legacy_1:9200 --timeout=120 -- echo "Legacy elastic search is up and running"
echo "Putting mappings"
echo "Putting minds_badger"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds_badger -d @./schema-legacy/minds_badger.json --header "Content-Type: application/json"
echo "Putting minds-graph"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-graph -d @./schema-legacy/minds-graph.json --header "Content-Type: application/json"
echo "Putting minds-helpdesk"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-helpdesk-2019 -d @./schema-legacy/minds-helpdesk.json --header "Content-Type: application/json"
echo "Putting minds-kite"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-kite-2019 -d @./schema-legacy/minds-kite.json --header "Content-Type: application/json"
echo "Putting minds-metrics"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-06-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-07-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-08-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-09-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-10-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-11-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-metrics-12-2019 -d @./schema-legacy/minds-metrics.json --header "Content-Type: application/json"
echo "Putting minds-moderation"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-moderation -d @./schema-legacy/minds-moderation.json --header "Content-Type: application/json"
echo "Putting minds-trending-hashtags-shrunk"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch-legacy_1:9200/minds-trending-hashtags-shrunk -d @./schema-legacy/minds-trending-hashtags-shrunk.json --header "Content-Type: application/json"
echo "Stopping legacy elastic search container"
docker stop minds_elasticsearch-legacy_1
#!/bin/bash
echo "Provisioning elastic search";
echo "Waiting for elastic search to come online..."
./wait-for.sh minds_elasticsearch_1:9200 --timeout=120 -- echo "Elastic search is up and running"
echo "Putting mappings"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch_1:9200/minds-views -d @./schema/minds-views.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch_1:9200/minds-boost -d @./schema/minds-boost.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch_1:9200/minds-offchain -d @./schema/minds-offchain.json --header "Content-Type: application/json"
curl -s --write-out ' Status: %{http_code}\n' -X PUT http://minds_elasticsearch_1:9200/minds-transactions-onchain -d @./schema/minds-transactions-onchain.json --header "Content-Type: application/json"
echo "elastic search is ready!"
{
"mappings": {
"pass": {
"_all": {
"enabled": true
},
"properties": {
"guids": {
"type": "long"
},
"user_guid": {
"type": "long"
}
}
},
"subscriptions": {
"_all": {
"enabled": true
},
"properties": {
"guids": {
"type": "long"
},
"user_guid": {
"type": "long"
}
}
}
}
}
{
"mappings": {
"question": {
"_all": {
"enabled": true
},
"properties": {
"answer": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"category_uuid": {
"type": "text"
},
"question": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"score": {
"type": "integer"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"preserve_separators": true,
"preserve_position_increments": true,
"max_input_length": 50
},
"uuid": {
"type": "text"
}
}
}
}
}
{
"mappings": {
"user-state": {
"_all": {
"enabled": true
},
"properties": {
"activity_percentage": {
"type": "double"
},
"previous_state": {
"type": "text"
},
"reference_date": {
"type": "date"
},
"state": {
"type": "keyword"
},
"user_guid": {
"type": "long"
}
}
},
"active_user": {
"_all": {
"enabled": true
},
"properties": {
"activity_percentage": {
"type": "double"
},
"previous_state": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"reference_date": {
"type": "date"
},
"state": {
"type": "keyword"
},
"user_guid": {
"type": "long"
}
}
}
}
}
{
"mappings": {
"action": {
"properties": {
"@timestamp": {
"type": "date"
},
"action": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ban_reason": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"boost_entity_guid": {
"type": "long"
},
"boost_quality": {
"type": "long"
},
"boost_rating": {
"type": "long"
},
"boost_reject_reason": {
"type": "long"
},
"boost_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"comment_guid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"cookie_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"email_campaign": {
"type": "keyword"
},
"email_state": {
"type": "keyword"
},
"email_topic": {
"type": "keyword"
},
"entity": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entityGuid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entityOwnerGuid": {
"type": "long"
},
"entitySubtype": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entityType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entity_access_id": {
"type": "long"
},
"entity_container_guid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entity_guid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entity_membership": {
"type": "long"
},
"entity_owner_guid": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entity_subtype": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"entity_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ip_addr": {
"type": "ip"
},
"ip_hash": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ip_range_hash": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"is_remind": {
"type": "boolean"
},
"logged_in": {
"type": "boolean"
},
"mobile_version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"platform": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"product": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ratelimit_key": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"ratelimit_period": {
"type": "long"
},
"referrer_uri": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"route_uri": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"user_agent": {
"type": "text",
"fields": {