1. How to create two Postgres databases on Linode?


    Even though Pulumi does not have native support for Linode as of now, we can utilize Linode's APIs to create resources, including databases. Unfortunately, there is one caveat; Linode does not provide PostgreSQL as a managed database.

    However, you can create 2 VMs running on Linode and install PostgreSQL on them manually.

    Here's a simple Pulumi program that creates 2 Linode instances. After creating these instances, you can manually install PostgreSQL on them:

    import * as pulumi from "@pulumi/pulumi"; import * as linode from "@pulumi/linode"; const ubuntu = linode.getStackscript({ mostRecent: true, label: "Ubuntu", }); const myDataBase1 = new linode.Instance("myDataBase1", { image: "linode/ubuntu18.04", label: "myDataBase1", rootPass: "secretRootPassword", stackscriptId: ubuntu.then(ubuntu => ubuntu.id), stackscriptData: { "key1": "value1", "key2": "value2", }, }); const myDataBase2 = new linode.Instance("myDataBase2", { image: "linode/ubuntu18.04", label: "myDataBase2", rootPass: "secretRootPassword", stackscriptId: ubuntu.then(ubuntu => ubuntu.id), stackscriptData: { "key1": "value1", "key2": "value2", }, });

    In the above code, we are creating two Linode instances and labeling them myDataBase1 and myDataBase2. The rootPass field is set to secretRootPassword, which you should change to your own secure root password. And stackscriptData is to provide custom data that will be passed into your StackScripts, you can also adjust to your needs. The two instances will have Ubuntu 18.04 as their OS.

    You can then SSH into the instances and manually install PostgreSQL. Check Linode's guide on how to install PostgreSQL here. After you set up the databases manually, you can use Postgres' JDBC or any other Postgres client to connect to the databases and manage it from your application.