No as a service - noaas
Find a file
2025-05-24 20:27:14 +02:00
extra/no-as-a-service rubocop and improved lang support 2025-05-24 20:27:14 +02:00
.rubocop.yml rubocop and improved lang support 2025-05-24 20:27:14 +02:00
app.rb rubocop and improved lang support 2025-05-24 20:27:14 +02:00
Containerfile initial 2025-05-13 07:58:31 +02:00
Gemfile rubocop and improved lang support 2025-05-24 20:27:14 +02:00
Gemfile.lock rubocop and improved lang support 2025-05-24 20:27:14 +02:00
languages.rb rubocop and improved lang support 2025-05-24 20:27:14 +02:00
no-as-a-service.jpg add languages and variants pluss logos 2025-05-20 22:30:51 +02:00
no-as-a-service.service initial 2025-05-13 07:58:31 +02:00
no.jpg add languages and variants pluss logos 2025-05-20 22:30:51 +02:00
noaas.jpg add languages and variants pluss logos 2025-05-20 22:30:51 +02:00
README.md initial 2025-05-13 07:58:31 +02:00

No-as-a-Service

This is a simple Ruby web service that responds with "No" in various languages. It's designed to accept both HTML and JSON requests and includes rate limiting, structured logging, and support for deployment using Podman and systemd.

Features

  • Returns "No" in multiple languages and styles.
  • Supports both HTML and JSON response formats.
  • Rate limiting to avoid abuse (30 requests per minute per IP).
  • Logs structured output, forwarding logs to journald for integration with systemd.

Files

  • app.rb: The main Ruby application file with Sinatra web service.
  • Containerfile: Instructions for building the container image using Podman.
  • no-as-a-service.service: systemd service configuration for managing the application.

Installation & Deployment

Prerequisites

  • Podman: To build and run the container.
  • systemd: For managing the service.
  • Journald: For logging.

Step 1: Build the Container Image

Clone the repository or download the files, and navigate to the folder containing the Containerfile and app.rb.

Run the following command to build the container image with Podman:

podman build -t noaas .

Step 2: Create the systemd Service

Copy the no-as-a-service.service file to your systemd service directory:

sudo cp no-as-a-service.service /etc/systemd/system/

Enable and start the service:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable --now no-as-a-service

Step 3: Accessing the Service

Once the service is running, you can access it at:

  • HTML Response: Open a browser and visit http://localhost:8080/.
  • JSON Response: Send a GET request to http://localhost:8080/ with an Accept: application/json header, or append ?format=json to the URL.

Logs

Logs are forwarded to Journald. You can view logs using:

journalctl -u no-as-a-service -t noaas -f

Rate Limiting

Each IP is limited to 30 requests per minute. If this limit is exceeded, the response will be a 429 Too Many Requests status with a JSON error message.

Customizing Language Responses

You can customize the "No" responses in various languages by modifying the NO_RESPONSES hash in app.rb.


License

This project is licensed under the MIT License - see the LICENSE file for details.