# Source: https://docs.squared.ai/deployment-and-security/setup/gce.md

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squared.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Compute Engine

## Deploying Multiwoven on Google Cloud Platform using Docker Compose

This guide walks you through setting up Multiwoven, on a Google Cloud Platform (GCP) Compute Engine instance using Docker Compose. We'll cover launching the instance, installing Docker, running Multiwoven with its dependencies, and accessing the Multiwoven UI.

**Prerequisites:**

* A Google Cloud Platform account with an active project and billing enabled.
* Basic knowledge of GCP, Docker, and command-line tools.
* Docker Compose installed on your local machine.

**Note:** This guide uses environment variables for sensitive information. Replace the placeholders with your own values before proceeding.

**1. Create a GCP Compute Engine Instance:**

1. **Open the GCP Console:** [https://console.cloud.google.com](https://console.cloud.google.com)
2. **Navigate to Compute Engine:** Go to the "Compute Engine" section and click on "VM Instances."
3. **Create a new instance:** Choose an appropriate machine type based on your workload requirements. Ubuntu is a popular choice.
4. **Configure your instance:**
   * Select a suitable boot disk size and operating system image (Ubuntu recommended).
   * Enable SSH access with a strong password or SSH key.
   * Configure firewall rules to allow inbound traffic on port 22 (SSH) and potentially port 8000 (Multiwoven UI, optional).
5. **Create the instance:** Review your configuration and click "Create" to launch the instance.

**2. Connect to your Instance:**

1. **Get the external IP address:** Once the instance is running, find its external IP address in the GCP Console.
2. **Connect via SSH:** Use your preferred SSH client to connect to the instance:

```
ssh -i your_key_pair.pem user@<external_ip_address>
```

**3. Install Docker and Docker Compose:**

1. **Update and upgrade:** Run `sudo apt update && sudo apt upgrade -y` to ensure your system is up-to-date.
2. **Install Docker:** Follow the official Docker installation instructions for Ubuntu: [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
3. **Install Docker Compose:** Download the latest version from the Docker Compose releases page and place it in a suitable directory (e.g., `/usr/local/bin/docker-compose`). Make the file executable: `sudo chmod +x /usr/local/bin/docker-compose`.
4. **Start and enable Docker:** Run `sudo systemctl start docker` and `sudo systemctl enable docker` to start Docker and configure it to start automatically on boot.

**4. Download Multiwoven `docker-compose.yml` file and Configure Environment:**

1. **Download the file:** 

```
curl -LO https://multiwoven-deployments.s3.amazonaws.com/docker/docker-compose/docker-compose.yaml
```

2. **Download the `.env` file:**  

```
curl -LO https://multiwoven-deployments.s3.amazonaws.com/docker/docker-compose/.env
```

3. **Create and Configure `.env` File:** Rename `multiwoven/.env.example` to `.env`. This file holds environment variables for various services. Replace the placeholders with your own values, including:
     \* `DB_PASSWORD` and `DB_USERNAME` for your PostgreSQL database
     \* `REDIS_PASSWORD` for your Redis server
     \* (Optional) Additional environment variables specific to your Multiwoven configuration

**Example `.env` file:**

```
DB_PASSWORD=your_db_password
DB_USERNAME=your_db_username
REDIS_PASSWORD=your_redis_password
# Modify your Multiwoven-specific environment variables here
```

**5. Run Multiwoven with Docker Compose:**

**Start Multiwoven:** Navigate to the `multiwoven` directory and run.

```bash  theme={null}
docker-compose up -d
```

**6. Accessing Multiwoven UI:**

Open your web browser and navigate to `http://<external_ip_address>:8000` (replace `<external_ip_address>` with your instance's IP address). You should now see the Multiwoven UI.

**7. Stopping Multiwoven:**

To stop Multiwoven, navigate to the `multiwoven` directory and run.

```bash  theme={null}
docker-compose down
```

**8. Upgrading Multiwoven:**
When a new version of Multiwoven is released, you can upgrade the Multiwoven using the following command.

```bash  theme={null}
docker-compose pull && docker-compose up -d
```

<Tip> Make sure to run the above command from the same directory where the `docker-compose.yml` file is present.</Tip>

**Additional Notes:**

<Tip>**Note**: the frontend and backend services run on port 8000 and 3000, respectively. Make sure you update the **VITE\_API\_HOST** environment variable in the **.env** file to the desired backend service URL running on port 3000. </Tip>

* Depending on your firewall configuration, you might need to open port 8000 for inbound traffic.
* For production deployments, consider using a managed load balancer and a Cloud SQL database instance for better performance and scalability.