nico.fyi
    Published on

    How to deploy Bluesky Later on your own server using Coolify

    Coolify makes it easy

    Authors

    A few months ago I released an open source project called Bluesky Later which is a web app that allows you to schedule Bluesky posts. The app has two modes: Browser mode and Self-hosted mode. In Browser mode, the app runs in the browser and doesn't need any server to run. In Self-hosted mode, the app runs on a server and you can schedule posts from anywhere.

    I have created a docker-compose file so that anyone can easily run Bluesky Later on their own server or computer. In the docker-compose file, all parts of the app are included: a Postgres database, the API server, the frontend, and the cron. So you can run docker-compose up and everything will be up and running in a few minutes.

    I am using the app on my own server but I don't run the docker-compose up command directly. Instead, I use Coolify to deploy the app. Coolify is a very cool project and I've been writing about it several times.

    Installing Bluesky Later on your own server using Coolify is very easy since Coolify supports running apps using docker-compose. After creating a new project in Coolify using the docker-compose method, you need to set some variables.

    Variable nameDescription
    CRON_SECRETA secret key that is used to authenticate the cron endpoint. You need to set this variable to a random string.
    POSTGRES_USERThe username for the Postgres database. You can use any username you want.
    POSTGRES_PASSWORDThe password for the Postgres database. You can use any password you want but make it hard to guess.
    POSTGRES_DBThe name for the Postgres database. You can use any name you want.
    DATABASE_URLThe URL of the Postgres database which includes the username, password, and database name. You have to use the same values for this variable as you did for the POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB variables. For example, if you set the POSTGRES_USER variable to "myuser", POSTGRES_PASSWORD variable to "mypassword", and POSTGRES_DB variable to "mydatabase", then you should set the DATABASE_URL variable to "postgresql://myuser:mypassword@postgres:5432/mydatabase". Note that the hostname is "postgres" and not "localhost" because it's the name of the service in the docker-compose file.
    VITE_API_URLThe URL of the API server. This should be the same URL you set in the "Domains for Api" field in the project's "General Settings" page, minus the port number. For example, if you set the "Domains for Api" field to https://api.example.com:3000, then you should set the VITE_API_URL variable to https://api.example.com.
    VITE_METADATA_FETCHER_URLThe URL of the metadata fetcher service. You can use https://linkpreview.magic.coolify.nico.fyi/api/v1/preview?url=
    VITE_IMAGE_PROXY_URLThe URL of the metadata fetcher service. You can use https://allorigins.magic.coolify.nico.fyi/raw?url=

    Then in the Configuration's General page, you need to set the "Domains for Api" field and "Domains for Frontend" field. In my case, I set the "Domains for Api" field to https://myapidomain:3000 and the "Domains for Frontend" field to https://myfrontendomain:80. Make sure to add the port number to the URLs.

    Finally, you can deploy the app. When all goes well, you should be able to access the app at https://myfrontendomain. You will be greeted with the initial setup page. Follow the instructions to set up your account and you should be able to start scheduling your Bluesky posts.

    Happy scheduling and say hi to me on Bluesky! 🦋