Skip to content

Commit

Permalink
docs: update deployment docs
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjoeoui committed Apr 29, 2024
1 parent 389dc69 commit 537e215
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 71 deletions.
84 changes: 18 additions & 66 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@ you can initialize the Terraform configuration by running:
terraform init
```

## 2. Setup an SSH key for the VM
## 2. Setup some environment variables

Generate an SSH key pair (RSA) with name `flojoy_cloud`,
and place it under the `~/.ssh` directory.
Create a file called `secret.tfvars` next to the `main.tf` file with the
following content filled out:

```bash
ssh-keygen -t rsa -b 4096 -f ~/.ssh/flojoy_cloud
```hcl
location = "canadacentral"
environment = "production"
web-dns-name-label = "flojoy-cloud-web"
server-dns-name-label = "flojoy-cloud-server"
entra-tenant-id = ""
entra-client-id = ""
entra-client-secret = ""
jwt-secret = "secret"
```

## 3. Plan and Apply
Expand All @@ -45,65 +55,7 @@ terraform apply -auto-approve

This process will take a few minutes to complete.

## 4. Access the VM

To access the VM, we need to get the public IP address.

```bash
terraform state show azurerm_linux_virtual_machine.flojoy-cloud-vm | grep "public_ip_address\s"
```

Then you can access the VM by running:

```bash
ssh -i ~/.ssh/flojoy_cloud adminuser@<public_ip_address>
```

## 5. Clone the repository

Once you have logged into the VM, you can clone the repository by running:

```bash
git clone https://github.com/flojoy-ai/cloud.git
```

## 6. Install Nixpacks

We are using Nixpacks to build the Docker images for deployment.

Before that, we need to make sure Docker and Nixpacks are installed.
## 4. Access the deployed services

The Terraform script has already installed Docker for you. You can verify
the installation by running:

```bash
docker --version
```

(Note: it may take a couple minutes before Docker is actually installed)

You can install Nixpacks by running:

```bash
curl -sSL https://nixpacks.com/install.sh | bash
```

[Install Nixpacks](https://nixpacks.com/docs/install)

## 7. Build the Docker images

Let's first make sure Docker is running:

```bash
sudo systemctl start docker

```

To build `web` and `server`, run these 2 commands respectively on the root of the
repository:

```bash
cd cloud
nixpacks build . --config apps/web/nixpacks.toml --name flojoy-cloud-web
nixpacks build . --config apps/server/nixpacks.toml --name flojoy-cloud-server
```
You deployed service will be accessible at
`https://<web-dns-name-label>.<location>.cloudapp.azure.com`
5 changes: 0 additions & 5 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ variable "entra-tenant-id" {
sensitive = true
}

variable "database-url" {
type = string
sensitive = true
}

variable "jwt-secret" {
type = string
sensitive = true
Expand Down

0 comments on commit 537e215

Please sign in to comment.