iconify / api

Iconify API script. Search engine for icons, provides icon data on demand for icon components, dynamically generates SVG.
MIT License
96 stars 34 forks source link

Bumping version to non-beta? #14

Closed markus-li closed 1 year ago

markus-li commented 1 year ago

Have been using your new and amazing TS-based API, it works great and just wanted to take the opportunity to thank you again. What I wanted to ask is if you will mark it as a non-beta version soon (currently 3.0.0-beta.1)? 3.0.1 maybe?

cyberalien commented 1 year ago

Yes, I think it can be safely bumped to stable. It has been running on API servers for almost a month without any issues.

The only issues I've ran into were caused by nginx, which I've removed after about a week, so app now runs on port 80 (SSL and security stuff is handled by Cloudflare).

There are still few things I do want to change before making it stable:

Hoping to finish those two tasks before end of year.

markus-li commented 1 year ago

The only issues I've ran into were caused by nginx, which I've removed after about a week, so app now runs on port 80 (SSL and security stuff is handled by Cloudflare).

What issues were these? I run iconify behind nginx without issues.

Looking forward to the future additions!

One thing I'd like to ask if it's not too much trouble, since keeping a container up-to-date is made easier by this, whenever you do push a change/fix, please bump the version number, even during beta.

cyberalien commented 1 year ago

What issues were these? I run iconify behind nginx without issues.

When too many queries were sent within few seconds, nginx was running out of sockets. After I fixed sockets config, it started throwing a different error, don't remember exactly what it was. Docs and various discussions about that error referred to it as a sign of a DoS attack. But server wasn't being attacked.

For users it was throwing errors for large chunk of requests, without them reaching Node process. Those requests that did get through to API, were responding very slowly.

At first I thought maybe there are too many async operations happening, so API can't handle that. So I've disabled all caching to make sure all data is always in memory and returned instantly. Even rewrote API using express instead of fastify as old version was running with express without any issues. That didn't solve it.

This was happening when server was getting about 6k queries per minute (from what I remember, number could be a bit lower or higher).

In my stress tests API could handle way more queries, so I thought maybe nginx is the problem, not API. Disabled nginx, put API on port 80 and all problems disappeared. Stress tested it by redirecting live traffic meant for several servers to one server + some artificial traffic, no problems at all. So nginx was the problem.

nginx is not really needed. I'm using Cloudflare to handle all https stuff, actual server IPs are not exposed and even if someone finds IP, there is nothing they can do with it other than just flood server, in which case server can be quickly removed from network and I can create a new one in 15 minutes.

markus-li commented 1 year ago

I understand that would be a situation I would not run into with how iconify is used by us, it's running inside LAN networks with no exposure to the Internet and normal load is a maximum of a few 100 requests for a second or so and then potentially nothing for a minute... Sounds like lots of work just to have the issue be nginx, glad you found it though :) it's definitely a good thing to keep in mind if we ever bring these services to run somewhere where the load could be in that range.

cyberalien commented 1 year ago

Getting closer to release.

Added function for generating CSS for icons: https://docs.iconify.design/api/css.html

Updated Docker config, added various NPM commands to easier manage Docker images, published API with default config to Docker Hub: https://hub.docker.com/r/iconify/api

cyberalien commented 1 year ago

Done. Version 3.0.0 has been published.