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

# Deployment

> How Geos is deployed and managed

## Overview

Geos is deployed using **PM2** process manager on all nodes.

## PM2 Commands

Check running processes:

```bash theme={null}
pm2 list
```

Stop all processes:

```bash theme={null}
pm2 stop all
```

Restart all processes:

```bash theme={null}
pm2 restart all
```

View admin panel logs:

```bash theme={null}
pm2 logs admin
```

## Database Access

To access the MySQL database:

```bash theme={null}
mysql -h geos-production-new.csqzdc49vgv3.eu-west-1.rds.amazonaws.com -u geos -p geos
```

<Warning>
  **Always use transactions** and set **autocommit to false** when working with the database:

  ```sql theme={null}
  SET autocommit = 0;
  START TRANSACTION;
  -- Your queries here
  -- COMMIT; or ROLLBACK; when done
  ```
</Warning>

## Deploying Server and Indexer

To deploy the server and indexer services on geos-02 and geos-03:

1. **SSH into the node**:
   ```bash theme={null}
   ssh geos-02
   # or
   ssh geos-03
   ```

2. **Switch to deployer user**:
   ```bash theme={null}
   sudo su - deployer
   ```

3. **Navigate to the geos directory**:
   ```bash theme={null}
   cd ~/geos
   ```

4. **Start the server** (port 3000):
   ```bash theme={null}
   source $HOME/.nvm/nvm.sh && nvm exec pm2 --name=server start server.js -f -- -p 3000
   ```

5. **Start the indexer** (port 4000):
   ```bash theme={null}
   source $HOME/.nvm/nvm.sh && nvm exec pm2 --name=indexer start indexer.js -f -- -p 4000
   ```

6. **Verify services are running**:
   ```bash theme={null}
   pm2 list
   ```

<Note>
  The `-f` flag forces PM2 to start the process even if it's already running. Use this when redeploying or restarting services.
</Note>

## Cache Refresh

To refresh Geos cache, you need to update the search API (Apache Solr) and refresh the cache on both server nodes (geos-02 and geos-03).

See [FAQ: How to refresh Geos cache?](/data-ai/geos/faq) for detailed instructions.
