$ npm install
$ DO_TOKEN=insert_do_token node create.js insert_snapshot_id insert_ssh_key_id
- Create a volume with a unique name of our choosing. This determines the name of the directory of where the volume will reside in the droplet.
- This is currently defined in the varialbe
volumeName
. - Using the ID generated, create a new droplet and attach the newly created volume.
- Volume is already automatically mounted on to the droplet during this process.
- Using the
user_data
parameter of creating a new droplet, inject shell commands that would transfer the data directory of the Postgres server to the attached volume.
$ if grep -qs '/mnt/${volumeName} ' /proc/mounts; then
> echo "It's mounted."
> else
> echo "It's not mounted."
> fi
Running this should return It's mounted
.
In SQL:
SHOW data_directory;
Running this should return the path /mnt/example/postgresql/12/main
.
Right now, unique data written so far would be the presence of the role public_readonly
. In SQL:
SELECT * FROM pg_roles;
Running this should return a list of roles including the role public_readonly
.