-
Notifications
You must be signed in to change notification settings - Fork 0
Front Ends cgit Calaca
syepes edited this page Oct 29, 2014
·
4 revisions
yum install openssl-devel
https://github.com/zx2c4/cgit/releases
make get-git
make
make install
mv /var/www/htdocs/cgit/cgit.cgi /var/www/cgi-bin/
# Files from the installation zip
cp /opt/cvm/cgit/cvm_cgit.conf /etc/httpd/conf.d/
cp /opt/cvm/cgit/cgitrc /etc/cgitrc
cp /opt/cvm/cgit/cvm.png /var/www/htdocs/cgit/
chown -R apache:apache /var/www/
systemctl enable httpd.service
systemctl start httpd.service
Details on setting up the official Elasticsearch repositorie
yum install elasticsearch
/usr/share/elasticsearch/bin/plugin -install fr.pilato.elasticsearch.river/fsriver/1.3.1
Restrict inbound access and start Elasticsearch
sed -i 's/^#cluster.name:.*/cluster.name: cvm/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/^#node.name:.*/node.name: N1/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/^#network.bind_host:.*/network.bind_host: 127.0.0.1/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/^#network.publish_host:.*/network.publish_host: 127.0.0.1/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/^#network.host:.*/network.host: 127.0.0.1/g' /etc/elasticsearch/elasticsearch.yml
systemctl enable elasticsearch.service
systemctl start elasticsearch.service
Configure FS River mappings and start indexing the CVM repository files
curl -XPUT 'localhost:9200/cvm' -d '
{
"analysis" : {
"char_filter": {
"quotes": {
"type": "mapping",
"mappings": [
"\\\u0022=>",
"\\\u0027=>",
"\\\u0028=>",
"\\\u0060=>",
"\\\u00B4=>",
"\\\u0091=>",
"\\\u0092=>",
"\\\u2018=>",
"\\\u2019=>",
"\\\u201B=>",
"\\\u201C=>",
"\\\u201D=>"
]
}
},
"analyzer" : {
"default" : {
"type" : "custom",
"tokenizer" : "whitespace",
"char_filter" : ["quotes", "html_strip"],
"filter": ["standard", "lowercase", "asciifolding", "trim"]
}
}
},
"doc" : {
"properties" : {
"content" : {
"type" : "string",
"store" : true
},
"file" : {
"properties" : {
"content_type" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
},
"filename" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
},
"filesize" : {
"type" : "long",
"store" : true
},
"indexed_chars" : {
"type" : "long",
"store" : true
},
"indexing_date" : {
"type" : "date",
"store" : true,
"format" : "dateOptionalTime"
},
"last_modified" : {
"type" : "date",
"store" : true,
"format" : "dateOptionalTime"
},
"url" : {
"type" : "string",
"index" : "no",
"store" : true
}
}
},
"meta" : {
"properties" : {
"author" : {
"type" : "string",
"store" : true
},
"date" : {
"type" : "date",
"store" : true,
"format" : "dateOptionalTime"
},
"keywords" : {
"type" : "string",
"store" : true
},
"title" : {
"type" : "string",
"store" : true
}
}
},
"path" : {
"properties" : {
"encoded" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
},
"real" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
},
"root" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
},
"virtual" : {
"type" : "string",
"index" : "not_analyzed",
"store" : true
}
}
}
}
}
}
}'
curl -XPUT 'localhost:9200/_river/cvm/_meta' -d '
{
"type": "fs",
"fs": {
"url": "/opt/cvm/repository/",
"update_rate": "1h",
"includes": "*.cfg"
}
}'
// Wait a couple of minutes and then search for something...
curl 'http://localhost:9200/cvm/doc/_search?pretty' -d '
{
"query": {
"query_string": {
"query": "Fortigate-4*"
}
}
}'
git clone https://github.com/romansanchez/Calaca.git /var/www/htdocs/calaca
chown -R apache:apache /var/www/htdocs/calaca
Change the following variables in the js/calaca.js
var indexName = "cvm";
var docType = "doc";
var maxResultsSize = 100;
var host = "<WEB SERVER FQDN>";
var port = 80;
Modify the "Listing of search results" section in the indes.html with the below lines
<article class='result' ng-cloak ng-repeat='result in results track by $id(result)'>
<h2>{{result.path.virtual}}</h2>
<a href="http://<WEB SERVER FQDN>/cvm/{{result.path.virtual}}.git/tree/{{result.file.filename}}" target="_blank">{{result.file.filename}}</a>
</article>
Configure the apache
# Files from the installation zip
cp /opt/cvm/calaca/cvm_search.conf /etc/httpd/conf.d/
systemctl restart httpd.service