direnv
nix
ornixos
If nix
is not available, you can try to make do with:
-
packer
-
terraform
with terraform-provider-secret -
A nixos image for Digital Ocean, you can try to make one with
packer
andnix-infect
as follows:packer build packer/build-image.json
Then manually make a snapshot of it in the Digital Ocean console.
# Build an image
IMAGE=$(nixos-generate -f do -c nix/base.nix)
# Push the image to Digital Ocean
packer build -var image=$IMAGE packer/push-image.json
If you've never run this before, you need to create some AWS resources to store the terraform state. We choose to store the state in the cloud to improve locking, and persist it between machines.
# make sure you have aws credentials in ~/.aws
cd terraform/tf-modules/terraform-state
terraform init
terraform apply
Now, you can run the rest of the deployment.
cp .env.example .env
$EDITOR .env # see variables.tf for advice on how to get certain vars
cd terraform
terraform init
terraform apply