Articles I've written for customers on IT issues.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
4.9 KiB

5 years ago
  1. ##########################################
  2. NOTE: read all of this before starting.
  3. Some steps were wrong...
  4. ##########################################
  5. Setting up searx on kvm vps w/docker:
  6. This guide assumes you have Docker already installed (if not follow the official documentation)
  7. This guide uses Devuan Ascii
  8. This guide is built on a VPS with KVM / Docker support. Note that many VPS (w/openVZ at the moment)
  9. do NOT support docker.
  10. It is helpful to have some experience with Docker. Buy a book, if you have not read one already.
  11. Other GNU/Linux Admin experience is assumed.
  12. This guide is meant as an adjunct to the official Searx Documentation on installing. Read that, also.
  13. Let's begin.
  14. First, clone the searx repo.
  15. cd into the directory.
  16. I had to make sure I pulled a specific tag release for searx
  17. otherwise the dockerfile build would fail.
  18. git checkout tags/v0.14.0
  19. then
  20. sudo docker build -t whatever/searx .
  21. here, you are building the dockerfile in the same directory and giving it a name: whatever/searx (which obv can be
  22. customized)
  23. see searx is available with
  24. docker images
  25. (at any time, you can type just docker, and it will list options)
  26. docker run -d --name searx -p $PORT:8888 whatever/searx
  27. here $PORT will pick a random port for searx to be listening on
  28. Test it works by viewing WANIP:PORT
  29. and it should work.
  30. problems:
  31. 1) searx has bing and default search engines
  32. 2) no https
  33. 3) no filter, to block spammers (we need to use the filter asciimoo made, or make our own...)
  34. Most important is 3, followed by 1, and 2, in that order.
  35. Also need to give it port 80, or port 443. (probably need reverse proxy for nginx or something)
  36. let's get a filter first.
  37. filtron is the filter.
  38. filtron sits between nginx and searx.
  39. nginx -> filtron -> searx
  40. https://asciimoo.github.io/searx/admin/filtron.html
  41. good news is, filtron is managed by package manager in go.
  42. first install go.
  43. i'm using devuan ascii so,
  44. apt-get install golang
  45. everyone online tells you to dl binary
  46. bad idea.
  47. slower, and unable to update. I am not dealing with un-updateable binaries.
  48. after you apt-get install need to set gopath
  49. put these two in /etc/profile:
  50. export PATH=$PATH:/usr/local/go/bin
  51. export GOPATH=/root/go
  52. in debian, go has a path in /usr/share
  53. which has pkg, src, test
  54. that is the GOROOT
  55. not the GOPATH
  56. so make something different for gopath
  57. Typically it is a folder in users Home directory.
  58. I had an error
  59. package math/bits: unrecognized import path "math/bits" (import path does not begin with hostname)
  60. Go version
  61. and forums show that mine is too old. I COULD use the binary, but that's not what I'm going to do.
  62. EDIT: let's try backports first....
  63. apt-get -t ascii-backports install golang
  64. that is 1.10
  65. not 1.7
  66. and that worked.
  67. So you MUST use ascii-backports for this.
  68. OK.
  69. so install it. get the rules.json in this folder as an example. Note that the default, requires
  70. you to set some variables
  71. run it with $GOPATH/bin/filtron -rules rules.json
  72. we will want to have it in the background, so something like above in rc.local (no service?)
  73. with the & afterwards, perhaps.
  74. So with filtron.
  75. we want to organize like this
  76. WAN
  77. nginx ----> filtron -----> docker ------> searx
  78. 443 4004 $PORT 8888
  79. We'll need to specify the docker port, and the filtron port, and the nginx port.
  80. let's use 20000 as docker port.
  81. ignoring nginx, we have
  82. filtron --help shows us
  83. FILTRON
  84. ============
  85. filtron -listen "127.0.0.1:4004" -target "127.0.0.1:20000" -rules rules.json
  86. NOTE: There is a trap with filtron. It expects a string, so -listen "127.0.0.1:4444" will work, but
  87. simply typing -listen 4444 will NOT work.
  88. Verify filtron is listening with ss -ntlp, where you should see:
  89. LISTEN 0 128 127.0.0.1:4005 *:*
  90. users:(("filtron",pid=27293,fd=3))
  91. LISTEN 0 128 127.0.0.1:4004 *:*
  92. users:(("filtron",pid=27293,fd=5))
  93. or similar.
  94. DOCKER
  95. ============
  96. docker run -d --name searx -p 20000:8888 whatever/searx
  97. searx is run by docker, and we don't need to worry about that.
  98. Then we need reverse ssl proxy for nginx.
  99. I can get that from the gitea page so I checked there first, and then here
  100. https://nginx.org/en/docs/http/configuring_https_servers.html
  101. lets encrypt will be later. (I have that covered in my own lets encrypt docs)
  102. so open a screen to test and run those, with & for filtron, docker will detatch with -d
  103. add
  104. location / {
  105. proxy_pass http://localhost:4004;
  106. }
  107. or just the proxy pass part to the nginx config. (make a copy of default, and edit the copy, add symbolic link
  108. to sites-enabled)
  109. And if you want to troubleshoot, you can do it step by step with the above example of reverse - reverse - reverse proxy to searx....
  110. wget the docker ip at 20000
  111. wget the filtron ip 4004
  112. wget the nginx at 80
  113. should all work.
  114. That's it.