added linux install script
This commit is contained in:
parent
aece63361d
commit
2e71b60248
4 changed files with 42 additions and 2 deletions
|
|
@ -24,7 +24,7 @@ GOOS=openbsd make vendor
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
See the `scripts/` directory on how to install docstore on OpenBSD.
|
See the `scripts/` directory on how to install docstore on Linux or OpenBSD.
|
||||||
|
|
||||||
## Config
|
## Config
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ func NewIndex(path string) (i *Index, err error) {
|
||||||
if _, err = os.Stat(path); os.IsNotExist(err) {
|
if _, err = os.Stat(path); os.IsNotExist(err) {
|
||||||
var m *mapping.IndexMappingImpl
|
var m *mapping.IndexMappingImpl
|
||||||
m, err = createMapping()
|
m, err = createMapping()
|
||||||
|
if err != nil {
|
||||||
|
err = errors.New("index: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
//m := bleve.NewIndexMapping()
|
//m := bleve.NewIndexMapping()
|
||||||
bi, err = bleve.New(path, m)
|
bi, err = bleve.New(path, m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func newContext(w http.ResponseWriter, r *http.Request, s *HTTPServer) *Context
|
||||||
h.Set("X-Frame-Options", "sameorigin")
|
h.Set("X-Frame-Options", "sameorigin")
|
||||||
h.Set("X-Content-Type-Options", "nosniff")
|
h.Set("X-Content-Type-Options", "nosniff")
|
||||||
h.Set("X-XSS-Protection", "1; mode=block")
|
h.Set("X-XSS-Protection", "1; mode=block")
|
||||||
h.Set("Content-Security-Policy", "default-src 'none';object-src 'self';frame-src 'self';style-src 'self';img-src 'self' data:;connect-src 'self';frame-ancestors 'self'")
|
h.Set("Content-Security-Policy", "default-src 'none';object-src 'self';frame-src 'self';style-src 'self';img-src 'self' data:;media-src 'self';connect-src 'self';frame-ancestors 'self'")
|
||||||
h.Set("Referrer-Policy", "same-origin")
|
h.Set("Referrer-Policy", "same-origin")
|
||||||
return &Context{
|
return &Context{
|
||||||
Request: r,
|
Request: r,
|
||||||
|
|
|
||||||
36
scripts/install_linux.sh
Executable file
36
scripts/install_linux.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh
|
||||||
|
groupadd docstore
|
||||||
|
useradd -g docstore docstore
|
||||||
|
mkdir /var/lib/docstore
|
||||||
|
chown docstore: /var/lib/docstore
|
||||||
|
mkdir /etc/docstore
|
||||||
|
cat <<EOF> /etc/docstore/docstore.conf
|
||||||
|
{
|
||||||
|
"run_dir": "/var/lib/docstore",
|
||||||
|
"listen_addr": "0.0.0.0:8080",
|
||||||
|
"secret": "$(openssl rand -hex 32)"
|
||||||
|
"langs": ["deu"],
|
||||||
|
"cmd_timeout": 6000,
|
||||||
|
"debug": true
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cat <<EOF> /etc/systemd/system/docstore.service
|
||||||
|
[Unit]
|
||||||
|
Description=DocStore
|
||||||
|
After=syslog.target
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
ExecStart=/usr/local/bin/docstore server -c /etc/docstore/docstore.conf
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable docstore
|
||||||
|
cat <<EOF
|
||||||
|
copy your docstore binary to /usr/local/bin/docstore
|
||||||
|
|
||||||
|
then run: systemctl start docstore
|
||||||
|
EOF
|
||||||
Loading…
Add table
Add a link
Reference in a new issue