> For the complete documentation index, see [llms.txt](https://docs.hivel.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hivel.ai/archive/generic/hivel-on-premises-deployment-guide-generic/14.-uninstall-and-cleanup.md).

# 14. Uninstall and Cleanup

**Stop and remove services:**

```
./deploy.sh --stop
docker-compose -f services/vm1/docker-compose.yml down
docker-compose -f services/vm2/docker-compose.yml down
```

**Remove the Docker network:**

```
docker network rm microservices_network
```

**Data retention decision:** the "insightly" database is not removed by the commands above. Decide whether to keep it (for a future reinstall or for compliance/audit reasons) or drop it:

* If self-hosted: psql -h $DB\_HOST -U \<root-or-privileged-user> -d postgres -c "DROP DATABASE insightly;"
* If managed (RDS/Azure Database for PostgreSQL/Cloud SQL): decide separately whether to also deprovision the underlying managed database instance in your cloud console - dropping the database does not deprovision the instance itself.

**Revoke credentials:** ask your Hivel contact to revoke the AWS ECR access credentials issued to you once uninstall is confirmed.

**Before you go further** - back up what you need: take a final pg\_dump of the "insightly" database (or a final snapshot if you're on a managed database service - see Backup and Restore), and export any logs you want to retain from /var/log/hivel/ on both VM1 and VM2.

**Fully decommissioning VM1 and VM2:** if you're retiring the deployment entirely, terminating both VMs at your hypervisor or cloud console is the fastest way to guarantee a clean uninstall - it removes everything created on those two hosts in a single action: all containers, the microservices\_network, the caddy\_data volume (if you set up Caddy-based HTTPS), pulled Docker images, config/.env, the license file copies, the log-rotation cron job, and /var/log/hivel/. If you're keeping the VMs for reuse instead, the manual docker-compose down / network-removal / database steps above cover the equivalent cleanup.

**Clean up infrastructure resources that don't die with the VM:** depending on your platform, also check for and remove, where applicable:

* Attached storage volumes, if "delete on termination" wasn't enabled
* Static/floating/elastic IP addresses assigned to the hosts
* Firewall rules or security groups created specifically for this deployment
* DNS records pointing at the hosts (e.g. if you configured Caddy-based HTTPS per DNS and HTTPS Setup)

**Revoke credentials that live outside the VMs:** terminating VM1/VM2 doesn't touch credentials that exist on other machines or in Hivel's systems:

* docker logout from Hivel's ECR on any setup or jump machine used outside the two VMs
* Deactivate or rotate the AWS IAM access key used for aws configure, if it was ever configured anywhere outside VM1/VM2
* Delete any backed-up copies of license\_signed.json and hivel\_onprem\_public.pem - secrets manager, config repo, or otherwise

**Revoke third-party integration credentials:** anything you issued from your own tools for Hivel to use should be revoked too - GitLab Personal Access Tokens, Jira API tokens, SonarQube tokens, Bitbucket App Passwords, and, if you connected Outlook, the Azure AD App Registration (or at minimum its client secret - this one is easy to forget, since it lives in the Azure Portal rather than on your hosts).

**Close out with Hivel:** email <support@hivel.ai> requesting deactivation of the license grant tied to your license\_signed.json, and rotation/revocation of any ECR pull credentials issued specifically to you.

**Next step**: none - if you're uninstalling, this is the end of the operational lifecycle covered by this guide.

<br>

{% columns %}
{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/13.-upgrade-and-rollback.md" class="button primary" data-icon="backward">Upgrade and Rollback</a>
{% endcolumn %}

{% column %}

{% endcolumn %}

{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/15.-security-and-secrets.md" class="button primary" data-icon="forward">Security and Secrets</a>
{% endcolumn %}
{% endcolumns %}
