Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Conversation

@ericpaulsen
Copy link
Member

@ericpaulsen ericpaulsen commented Sep 14, 2021

adding a guide for migrating data out of timescale and into an external postgreSQL instance. also includes cleans up existing db docs.

[ch12923]

@ericpaulsen ericpaulsen added the docs 📝 Improvements or additions to documentation label Sep 14, 2021
@ericpaulsen ericpaulsen self-assigned this Sep 14, 2021
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #12923: Document process of migrating PostgreSQL database.

1. Import the data into your database:

``` console
cat backup.sql > psql -U coder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cat backup.sql > psql -U coder
psql -U coder < backup.sql

Comment on lines 24 to 25
> If your database is large, you can truncate Coder's telemetry, metrics, and
> audit log to reduce the file size.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would probably be better to give specific examples for truncating

TRUNCATE metric_events;
TRUNCATE environment_stats;
TRUNCATE audit_logs;

> If your database is large, you can truncate Coder's telemetry, metrics, and
> audit log to reduce the file size.

1. Access your PostgreSQL instance and create user `coder`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Access your PostgreSQL instance and create user `coder`
1. Access your PostgreSQL instance and create user and database `coder`

1. Connect your Coder instance to the database:

```console
helm upgrade -n coder coder coder/coder \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
helm upgrade -n coder coder coder/coder \
helm upgrade --reuse-values -n coder coder coder/coder \

Comment on lines 2 to 3
title: Migrating data from TimescaleDB
description: Learn how to migrate data from the TimescaleDB to a PostgreSQL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to the built-in database as TimescaleDB is a bit confusing because we no longer use Timescale, and it's just a regular database. Maybe we just refer to it as the built-in Postgres or bundled Postgres.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense - thing is, the default db is still referred to as timescale-0 in the cluster. so it could get confusing for those not familiar with timescale.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 2021

✨ Coder.com for PR #607 deployed! It will be updated on every commit.

Copy link
Member

@deansheather deansheather left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colin's review is spot on

TRUNCATE audit_logs;
```

1. Access your PostgreSQL instance and create user and database `coder`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused by this; they should create a coder user AND a database coder?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, PostgreSQL has user, database, and schema. Multiple users can have access to a database, and database can have multiple schemas. So yes, people should create a user name coder that has access to a database, also named coder

@ericpaulsen
Copy link
Member Author

@khorne3 - let me know if we're good to merge. Thanks!

@khorne3
Copy link
Contributor

khorne3 commented Sep 16, 2021

@ericpaulsen sorry for the delay! just waiting for the preview and if it looks ok, we can ship!

@ericpaulsen
Copy link
Member Author

No worries! Appreciate your wordsmithing.

@ericpaulsen ericpaulsen merged commit e17e2d8 into main Sep 20, 2021
@ericpaulsen ericpaulsen deleted the ericpaulsen/timescalemigration branch September 20, 2021 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

docs 📝 Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants