/search.quarkus.io

Search backend for Quarkus websites

Primary LanguageJavaApache License 2.0Apache-2.0

Quarkus.io Search

A Quarkus-powered application that allows full-text search in websites of the Quarkus organization such as https://quarkus.io.

Development

To launch the application in dev mode:

quarkus dev
# OR
./mvnw quarkus:dev

Then head over to http://0.0.0.0:9000/q/swagger-ui/ to try the service.

Note

Indexing happens on startup.

Because there is a lot of data to fetch before indexing, by default dev mode will use a small sample of quarkus.io included in this repository.

To use the actual quarkus.io data, consider cloning the quarkus.io repository manually and adding a .env file to your working directory (it will be ignored by git if you try to contribute something):

_DEV_FETCHING_QUARKUSIO_URI=file:/home/myself/path/to/quarkusio.github.io

Alternatively, to test actual retrieval from a git repository, pass -Dfetching.quarkusio.type=git to the startup command:

quarkus dev -Dfetching.quarkusio.method=git
# OR
./mvnw quarkus:dev -Dfetching.quarkusio.method=git

Testing

Testing (and, by default dev mode) will use a small sample of quarkus.io included in this repository at src/test/resources/quarkusio-sample.zip.

This sample must itself be a git repository, so generating it can get technical.

Fortunately, there is a tool included in this project to generate the sample. To update the sample:

  • Add the references of the guides you want included in the sample to GuidesRef.

  • Run QuarkusIOSample.main() using your IDE, with the project root as the current working directory, and passing as first (and only) command-line argument the path to your clone of quarkus.io.

Production

If you want to start a (production) container locally, you can build one with the following command:

quarkus build -DskipTests -Dquarkus.container-image.build=true -Dquarkus.container-image.builder=jib
# OR
./mvnw install -DskipTests -Dquarkus.container-image.build=true -Dquarkus.container-image.builder=jib

Then start it this way:

podman pod create -p 8080:8080 -p 9000:9000 -p 9200:9200 --name search.quarkus.io
podman container run -d --name elasticearch --pod search.quarkus.io \
    -e "discovery.type=single-node" -e "xpack.security.enabled=false" \
    -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" -e "cluster.routing.allocation.disk.threshold_enabled=false" \
    elastic/elasticsearch:8.10.2
# Then the app; this will fetch the actual data on startup (might take a while):
podman container run -it --rm --pod search.quarkus.io search-quarkus-io:999-SNAPSHOT
# OR, if you already have a local clone of quarkus.io:
podman container run -it --rm --pod search.quarkus.io \
    -v $HOME/path/to/quarkusio.github.io:/mnt/quarkus-io:ro,z \
    -e FETCHING_QUARKUSIO_URI=file:/mnt/quarkus-io \
    search-quarkus-io:999-SNAPSHOT

Deployment

Current process

Deployment should happen automatically when pushing to the main branch.

Maintainers can review the application and update configuration/secrets at https://console-openshift-console.apps.ospo-osci.z3b1.p1.openshiftapps.com/

Be careful about which configuration you change in the UI, as deployment may overwrite part of the topology.

Setting it up

Most of the process is automated, but if you need to deploy to a new cluster, you will need to set up a few things manually:

  1. Service account for GitHub Actions deployment. The account credentials (username/token) need to be registered as GitHub Actions secrets, as well as the cluster URI. See .github/workflows/deploy.yml.

  2. Namespace The OpenShift namespace needs to be registered as a GitHub Actions environment variable. See .github/workflows/deploy.yml.

  3. Config maps and secrets.

    search-quarkus-io-config

    Environment variables for the application. Put in there whatever configuration you need for your specific cluster.

    search-quarkus-io-secret

    Secret environment variables for the application. Put in there whatever secret configuration you need for your specific cluster.

    search-backend-config

    Environment variables for the Elasticsearch instances. Put in there whatever configuration you need for your specific cluster.

    search-backend-secret

    Secret environment variables for the Elasticsearch instances. Put in there whatever secret configuration you need for your specific cluster.

License

This project is licensed under the Apache License Version 2.0.