quarkusio / search.quarkus.io

Search backend for Quarkus websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quarkus.io Search

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

Development

Using the built-in quarkus.io sample

Note

By default, this will use a small sample of quarkus.io included in this repository, which has the advantage of being faster to index on startup, but is incomplete.

To index the actual data, see Using the actual quarkus.io data.

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.

Using the actual quarkus.io data

To use the actual quarkus.io data without downloading it on each startup, you should clone the quarkus.io repository manually and add a .env file to your working directory:

_DEV_QUARKUSIO_GIT_URI=file:/home/myself/path/to/quarkusio.github.io
_DEV_QUARKUSIO_LOCALIZED_JA_GIT_URI=file:/home/myself/path/to/ja.quarkus.io
_DEV_QUARKUSIO_LOCALIZED_ES_GIT_URI=file:/home/myself/path/to/es.quarkus.io
_DEV_QUARKUSIO_LOCALIZED_PT_GIT_URI=file:/home/myself/path/to/pt.quarkus.io
_DEV_QUARKUSIO_LOCALIZED_CN_GIT_URI=file:/home/myself/path/to/cn.quarkus.io
# Avoid reindexing on startup if indexes already contain data.
# You can remove this if you're fine with waiting a few minutes on each live reload.
_DEV_INDEXING_ON_STARTUP_WHEN=indexes-empty

Then the application will use data from that clone when indexing on startup.

If you also intend to run quarkus.io locally, and want links of search hits to redirect to your local instance of quarkus.io, you should also add this property:

_DEV_QUARKUSIO_WEB_URI=http://localhost:4000

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 (alongside with the localized site samples such as quarkusio-sample-cn.zip, quarkusio-sample-es.zip, quarkusio-sample-ja.zip, quarkusio-sample-pt.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 command-line argument the path to your clone of quarkus.io.

  • To update the localized site samples as well, pass pairs of language code and path to corresponding localized site as command line arguments, e.g.ja path/to/ja.quarkus.io. Add pairs for all cn, es, ja, pt language codes to update all samples at the same time.

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" \
    docker.io/opensearchproject/opensearch:2.11.0
# 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 QUARKUSIO_GIT_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 OpenSearch instances. Put in there whatever configuration you need for your specific cluster.

    search-backend-secret

    Secret environment variables for the OpenSearch 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.

About

Search backend for Quarkus websites

License:Apache License 2.0


Languages

Language:Java 92.0%Language:TypeScript 6.8%Language:SCSS 0.6%Language:HTML 0.4%Language:Dockerfile 0.1%