Blog of science and life

Contact
Archives
Feed

Fly.io - perfect solution


Fly.io - A review

After a month trying Fly.io, I must say that:

Fly.io is awesome!.

After a year using Hosthatch, I tired of their terrible uptime, sometime the servers is down for 2 days. I'm not sure why, but I'm sure that I'm not going back to them.

Luckily, I've found Fly.io. It's cheap, fast and reliable. I'm moving all my services to Fly.io. And to be honest, it's so easy that make me feel like I'm cheating.

Guide to migrate

If you have a Dockerfile for your service, you can migrate to Fly.io in 5 minutes.

Here are some examples.

Vaultwarden (No Postgres, No Redis)

Create Dockerfile

FROM vaultwarden/server:latest

Launch a new app

Run fly launch and follow the instruction. You can choose any name and server region you want.

After deployed, you can access at <app-name>.fly.dev.

Create new …

Read more

Django Signal + Celery


Nếu bạn muốn dùng Celery task trong các Signals của Django, bạn cần làm như sau để tránh tình trạng bắn task quá nhanh, khiến bên trong task nếu query pk=id sẽ bị lỗi NotFound (do dữ liệu chưa kịp lưu vào database).

from django.db import transaction
from .models import MyModel
from .tasks import task

@receiver(post_save, sender=MyModel)
def my_model_post_save(sender, instance, **kwargs):
    transaction.on_commit(lambda: task.delay(args=(instance.id,)))

Ở đây ta đợi transaction commit xong mới chạy task. Problem solved.

Read more

Contabo server review


A review

After a month trying Contabo, I must say that:

Don't use their servers.

Their storage bandwith policy is good, I will keep continue using it. But no way I'm go back for their server.

It's always down!

I have no idea why.

Their supporter is nice, but did not help.

Solution

I'm going to use HostHatch for an experiment.

They have a lot of locations in Asia, like Hongkong, Singapore and Japan (with cheap price).

I'll comeback for more reviews.

You can register with my affiliate link here

Read more

« Page 2 / 4 »