Self hosting Minio in 2025 and connect with kafka.
By the time this is out the name is probably going to be Aistor.
Have you ever tried self hosting your own AWS S3 alternatives? https://www.min.io/ is one of them.
Previous versions of it used to have all configuration settings available in the web dashboard, now it only offer the object storage visualization. My guess is that it allows them to focus on improving the features that matters, without wait for the ui for feature parity; but I also believe is to leverage infrastructure automation tools.
The way to create a RAG application.
Recently I launched promplty promplty.jaconsta.com to help you create a better prompt that you can input into your favorite LLM. It uses a RAG system from a collection of curated prompts and the power of LLMs to give the user a better prompt.
A RAG (Retrieval-Augmented Generation) helps its creators improve the response from LLMs by providing it with relevant context regarding the area the software and the input is designed for.
Does good code even matter?
Does good code even matters?
Many years ago, during a code review for an API endpoint I found a colleage called a controller function from another controller.
Imagine it was something like
#router.get("/products/:id")
def getProduct(id):
return ProductSchema.dumps(ProductModel.find_one(id))
#router.post("/products")
def create_product():
new_product = ProductModel.create(ProductSchema.load(request.body))
return getProduct(new_product.id)
I remember getting on the nerves, for the simple output my colleage took; but also without much to argue agains because
part of the fault was also mine, who coded getProducts was me, the initial design and coupling was made by me,
and my colleage just kept on working assuming the pattern was correct.
Javascript ecosystem is chaos, but it is ok.
I believe the JS community loves to shoot itself in the foot.
Probably some heard the message, at the begining of 2023, from one of the TS creators recommending to not always set the return type explicitly in in the function definition, and that triggered some very good developers that are against this recommendation. (BTW TS: Typescript, JS or js: javascript)
JS is a language of constant changing, enormous growth and one that I am deeply grateful for all the good it has brought to my life and the world in general. The fact that it set itself to be the language of the browsers (the internet) and later of the servers (NodeJS) is a true miracle.
How to use absolute imports with React
Starting from React scripts you can now use absolute imports to use your components.
What’s the problem?
Imagine you have the following simple code structure.
/src
--/Components
--/Home/Top.js
--/A/Really/Deep/Component.js
--App.js
If you wanted to import, say… Top into App, you would normally do:
App.js
import Top from './Home/Top'
So what’s the problem?
Imagine you want to import Top into Component, then you would have:
import Top from '../../../../Home/Top'
Did you count the folders I went back? I didn’t so it might not match.
Easy run your html with docker and Nginx
If you’ve ever needed to quickly run a built or a static html (js and css) site.
In my case it helps to preview and test locally Go Hugo built sites, react built content or preview any site I’m given.
A tool like Browser sync would work perfectly, and gives lots of tools. But a more “real” scenario would be using a true server like Nginx.
First you need to have Docker installed and the the Nginx image.
Configure static IP on your device
If you have ever installed any kind of server in your house or office.
And if it’s Linux (Unix) based, you surely have been affected by the issue
of the network changing over time. You need to check you device ip (ex. ifconfig)
to see which is your current IP.
There is a way to avoid this, and set a fixed IP on your device. This is really useful if you have to make any device discoverable. I will take the command line approach here.
Easy deploy your react server with Nginx
Now you have your react project and you want to create a simple deploy server.
Install your host server. We are going to use a Nginx proxy server. This is an example for a Debian based system.
sudo aptitude install nginx-light
For this example we don’t need the full Nginx server.
Nginx creates a default host file. Then you can place the content of your build files under /var/www/default and it should be enough.
Configure Systemd to launch a Django project
I am going to use systemd to ensure that our server runs on startup.
Let’s assume your django project is under /opt/django_server.
You have created a virtual environment under /opt/django_server/venv.
And you have installed the gunicorn server.
First create the systemd django_server.service file.
[Unit]
Description=Our Django server
[Service]
Restart=on-failure
WorkingDirectory=/opt/django_server
Environment=PYTHONPATH=/opt/django_server/venv/bin
ExecStart=/opt/django_server/venv/bin/gunicorn django_server.wsgi:application --name django_server --bind 0.0.0.0:8000 --workers 3
[Install]
WantedBy=multi-user.target
It contains three sections.
- Unit Description of the service and requirements.
- Service Details on how the service will run.
- Install Target of the service.
Place your file under /etc/systemd/system/
Setting PostgreSQL using docker
You, of course, need to have docker installed.
Download the Postgres image.
$ docker pull postgres
This will pull the latest version of the database available. If you want a different version you can specify it changing the word postgres for postgres:9.6 in this case to get the version 9.6.
Start the container
docker run --name pg-local -e POSTGRES_PASSWORD=pgpassword -d -p 5432:5432 -v $HOME/Documents/docker/db_vol/postgres:/var/lib/postgresql/data postgres:9.6
pg-local is the name of the container.
pgpassword is going to be the postgres user password inside the container.