An open API service indexing awesome lists of open source software.

https://github.com/flavienbwk/icons-visualizer

A quick and simple UI and API to search and display icons or images. Can be used in an offline environment thanks to Docker.
https://github.com/flavienbwk/icons-visualizer

docker docker-compose flask-restplus kubernetes python3 reactjs search-engine visualizer

Last synced: 3 months ago
JSON representation

A quick and simple UI and API to search and display icons or images. Can be used in an offline environment thanks to Docker.

Awesome Lists containing this project

README

          

# Icons Visualizer








A quick and simple UI and API to search and display icons. Can be used in an offline environment thanks to Docker. Database-free.

![Interface example](./interface.png)

Written in Python (Flask RESTPlus / Swagger) and ReactJS.

## Get started

Import the icons you want in the `icons/` directory.

:information_source: **The name of your files** are very important : the search engine is based on filenames to find search keywords.

### Build for dev

```bash
docker-compose up -d
```

You can access the UI at `localhost:8080`

### Build for prod

```bash
docker-compose -f prod.docker-compose.yml up --build -d
```

You can access the UI at `localhost:8080`

### Deploy to K8S

I pretend you have here your K8S instance configured to be accessed by your `kubectl` CLI.

I've used [Scaleway Kapsule](https://www.scaleway.com/en/kubernetes-kapsule) to perform my tests. This is an easy way to have a Kubernetes cluster quickly ready.

1. Building production images (optional)

Images are tagged `flavienb/icons-visualizer-{api,web,nginx}:latest` by default. Edit it in `prod.docker-compose.yml` before building.

:information_source: You might be interested in pushing your images in a private registry (e.g: [Scaleway's Container Registry service](https://www.scaleway.com/en/container-registry/)).

```bash
docker-compose -f prod.docker-compose.yml build
```

Finally, `docker push` the 3 images and edit K8S' configurations :

- [k8s/web.yaml, line 26](k8s/web.yaml#L26)
- [k8s/api.yaml, line 21](k8s/api.yaml#L21)
- [k8s/nginx.yaml, line 21](k8s/nginx.yaml#L21)

2. Add a new `icons-visualizer` namespace

```bash
kubectl create namespace icons-visualizer
```

3. Considerations on persistant volume for icons

You have 4 options to see your icons on Kubernetes :

- Create a `PersistentVolume` with `spec.local` pointing to a path on a node and import your icons inside (requires an SSH access to this node)
- Use a remote NFS server
- Copy all of your icons in your Docker image
- Use a S3 server such as MinIO and import your pictures via a web interface

For this example, I'll go with MinIO so you have a light image to deploy.

4. Configure your Ingress app endpoint

- **Define** the app and MinIO endpoints in [k8s/ingress.yaml, line 10 and 20](./k8s/ingress.yaml#L10)
- **Check** the env variables in [k8s/env-configmap.yaml](./k8s/env-configmap.yaml)
- **Check** the PersistentVolumeClaim if you're not using Scaleway, in [k8s/minio-pvc.yaml](./k8s/minio-pvc.yaml)

Deploy with :

```bash
kubectl apply -f ./k8s --namespace icons-visualizer
```

5. Add icons

Connect to the MinIO interface and add your icons in the `icons` bucket.

Start a new search in the Icons Visualizer UI and enjoy !

> :information_source: The API will look up for new icons in S3 and file-system [every minute](./api/app/utils/Icons.py#L15).