If you want to deploy this server to a new GCE account, use the following instructions to configure it:
Create a Google Cloud Compute project:
- Create an account with Google Cloud Compute or sign in with an existing account.
- Go to the Console for your account.
- Under the Project menu click Create Project, provide a project name, and create the project.
- Once created the new project should be selected as the current project in the console.
Create a service account that will run the deployment:
- While in your project on Google Cloud Platform, under the "hamburger menu" (pop-in sidebar), select IAM & Admin then select Service accounts.
- Click CREATE SERVICE ACCOUNT at the top.
- Choose a name for your new service account that reminds you of its function: a deployment manager.
- Select both the Editor and Viewer roles.
- Enable the Furnish a new private key setting and select the P12 format.
- Create the account and remember the key passphrase (probably
notasecret
). - Convert the P12 key to a PEM key by running the following, replacing
{key}
with the name of your key file (without the extension) and{notasecret}
with the key password:openssl pkcs12 -in {key}.p12 -passin pass:{notasecret} -nodes -nocerts | openssl rsa -out {key}.pem
Configuring deployment:
- Copy
server/gce.keys.nix.sample
toserver/gce.keys.nix
. - Replace the
...
with your project and credentials.
To deploy to production, you will use similar steps as deploying to VirtualBox (see the README):
- Configure
server/physical.gce.prod.nix
to your preferences. deploy/manage prod create '<server/logical.nix>' '<server/physical.gce.prod.nix>'
(cd deploy && ./manage prod deploy)
It may take a long time to build the server and upload all the dependencies.
IMPORTANT: You must keep the deployment state in deploy/prod.nixops
up-to-date in the repository. Once you run the deploy/manage prod deploy
command above, you must commit that file and always commit it any time you do a deployment that causes it to change. The deploy/manage
script is designed to keep these state files up-to-date on every deployment so that you can be sure to have the right file in your repository. Do not allow simultaneous deployments and always use the deployment state file that actually corresponds to the state of the server.
Once you've made a deployment and committed its .nixops
file to the repository, anyone on your team can deploy who has git-crypt
access to the file. The steps are just like before:
deploy/manage prod info
(get info about the production deployment)(cd deploy && ./manage prod deploy)
(deploy to production)git add deploy/prod.nixops && git commit -m"Deployment"