Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 242e725d authored by Israel Yago Pereira's avatar Israel Yago Pereira
Browse files

Index and search e docs

parent 38666d0a
Loading
Loading
Loading
Loading

.example.env

0 → 100644
+3 −0
Original line number Diff line number Diff line
ALLOW_ORIGINS="*"
ES_HOST="localhost"
ES_PORT=9200
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
__pycache__/
.env
venv
 No newline at end of file

.gitlab-ci.yml

0 → 100644
+35 −0
Original line number Diff line number Diff line
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
variables:
    DOCKER_DRIVER: overlay2
stages:
  - build
  - deploy
default:
  image: docker:20.10

# Build stage
.build:docker:
  stage: build
  tags:
    - generic_privileged
  services:
    - docker:20.10-dind
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
    - docker build . --pull -t "$CI_REGISTRY_IMAGE:$IMAGE_TAG" -f Dockerfile
    - docker push "$CI_REGISTRY_IMAGE:$IMAGE_TAG"

build:branch:
  extends: .build:docker
  rules:
    - if: '$CI_COMMIT_TAG'
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - if: '$CI_PIPELINE_SOURCE =~ /schedule|web|api|trigger/ && $IMAGE_TAG != $CI_COMMIT_REF_SLUG'
      when: never
    - when: on_success
  variables:
    IMAGE_TAG: $CI_COMMIT_REF_SLUG

Dockerfile

0 → 100644
+12 −0
Original line number Diff line number Diff line
FROM python:3.9.6-alpine3.13 AS py

EXPOSE 5000

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY src .

CMD [ "flask", "run" ]
 No newline at end of file
+27 −1
Original line number Diff line number Diff line
@@ -2,6 +2,32 @@

Full-text search for your Jekyll blog with ElasticSearch.

## Installation
1. Clone the project
1. run `python3 -m venv venv` to create the virtual env
1. run `. venv/bin/activate` to be able to use the python packages
1. run `pip install -r requirements.txt` to install all packages

To be able to use the linting inside the virtual environment, it is recomended to use the python inside the virtual env folder. Take a look at [here](https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment) for vscode

## Development
1. You need a running copy of elasticsearch:
```bash
docker run \
--name elasticsearch \
--rm \
-p 9200:9200 \
-p 9300:9300 \
-e "discovery.type=single-node" \
elasticsearch:7.13.3
```
1. Make sure you are at the virtual env (run `. venv/bin/activate`)
1. To index your content, run: `python3 src/main.py "PATH_TO_YOUR_CONTENT"`
1. run `export FLASK_ENV=development`
1. run `export FLASK_APP=src/app`
1. run `flask run`


## Features

 - Parses the html from your Jekyll `_site` directory using BeautifulSoup to get more accurate content instead of using the raw Markdown.
@@ -13,7 +39,7 @@ Full-text search for your Jekyll blog with ElasticSearch.
### Indexing:

 - Make sure you have an ElasticSearch server running. If not local, change the config in `indexer.py` to reflect your location.
 - Run the command `python main.py <path_to_blog>`, running without an argument will assume your compiled blog is located at `~/blog/_site`.
 - Run the command `python src/main.py <path_to_blog>`, running without an argument will assume your compiled blog is located at `~/blog/_site`.
 - If the library cannot find your content correctly, modify `indexer.py` to point to the correct HTML elements for title, post content etc (assuming you have unique CSS classes for these).

### Searching:
Loading