Easy solr

How do you actually install an apache solr server?

The only search engine for TYPO3 that actually delivers convincing results is solr.

There is an excellent extension for this(Apache Solr for TYPO3 - Enterprise Search) with which you are actually almost completely happy. If you also want to index your files, use solrfal. You can find it here.

But wait, you need a solr server for this, how does that work?

Yes, this is where it gets a bit tricky because you need java, tomcat and solr in the right versions for the solr to run. This then has to be installed in the right places in the system and if you have done everything correctly, the whole thing will run until the next update.

Yay. With the next update, everything is somehow different and the part that is the same, I have documented incorrectly (or in my case not at all, then that's so easy, you can't forget that)

Sounds uncool - and it is ...

But there is Docker

For all those who don't know Docker, here in a nutshell: Docker is a container in which you can install the components mentioned above, for example. Add a rudimentary mini-Linux and the solr server is ready. If one of the components is now updated, a new container is simply created with the new package. The whole thing then runs like a single program.

But what is the advantage here?

Quite one: There is an official solr container that is maintained by the solr makers. Here the DevOp does not have to worry about whether everything works together correctly. Simply download and start - done (well almost, but it's not much more than that).

Let's start again.

Before we play around with Docker, we need to install it. How to do this exactly is described here.

So we need a solr with accessories. If you have solrfal at the start, you also need tika. In the extension mentioned above we find an excellent setup with the help of which we can build a super simple solr installation.

The details can be found here: https://github.com/mxsteini/solrForTYPO3

Download and start

git clone https://github.com/michaelstein-itb/solr-server-typo3.git
cd solr-server-typo3
docker compose up -d
# In the following, a network with 2 servers is set up.
# Internally, the servers are called "solr" and "tika"


services:
# 
    solr:
        # we want solr to always restart if it has crashed.
        restart: always

        # this is the name of the image for our solr
        image: dbgrs/solr
        # because the image does not yet exist, we have to build it ourselves at the first start
        build:
            context: .
            # The building instructions are here
            dockerfile: ./SolrServer/Dockerfile

        # We want the solr to be accessible only on the local computer. 
        ports:
            - 127.0.0.1:8983:8983

        # the indexes are in ./data
        volumes:
            - ./data:/var/solr/data/data

    tika:
        # For tika we can use the official image. This is automatically downloaded at the first start
        image: apache/tika:latest

        # we want tika to always restart if it has crashed.
        restart: always

        # tika should also only be accessible on the local computer
        ports:
            - 127.0.0.1:9998:9998


volumes:
    solr:

And the updates?

With tika it's simple. Whenever we type "docker compose restart", Docker checks whether there is a new tika.

With solr, we have to proceed a little differently.

Since we are dependent on the solr extension here, we should always make sure that we use its Dockerfile to build the new Docker.

If you want to work directly with the solr interface, remove the "127.0.0.1:" and then call it:

docker compose stop && docker compose rm -f && docker compose build && docker compose up -d

Comments

No Comments

Write comment

* These fields are required