File size: 2,810 Bytes
35ee763
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
slug: upgrade-210
title: Upgrade to 2.1.0
author: M Gilang Januar
author_title: The Creator
author_url: https://github.com/mgilangjanuar
author_image_url: https://avatars.githubusercontent.com/u/3146378?v=4
tags: [releases]
---

## What's New?

- Users Management (Admin Panel)

![](./SCR-20220408-nvj.png)

## Upgrade Guide

### 1. Pull from GitHub

```shell
git reset --hard
git clean -f
git pull origin main
```

### 2. Update variables

There's a new environment variable that you can added to your application:

- `ADMIN_USERNAME`: this variable is used for login to the admin panel.

Select how you install your application to update your environment variable:

- Manual installation:

  Add `ADMIN_USERNAME` to `server/.env` file:

  ```shell
  echo "ADMIN_USERNAME=your_telegram_username" >> server/.env
  ```

- Docker installation:

  Add `ADMIN_USERNAME` to `docker/.env` file:

  ```shell
  echo "ADMIN_USERNAME=your_telegram_username" >> docker/.env
  ```

- Heroku:

  ```shell
  heroku config:set ADMIN_USERNAME=your_telegram_username
  ```

- Vercel:

  Go to the dashboard, select your project, and go to the **Settings > Environment Variables**. Then, add key: `ADMIN_USERNAME` and value: `your_telegram_username`.

### 3. Update database

There's a new SQL file that you have to migrate to your database:

- `dump.20220406.sql`

Select how you install your application to update your database schema:

- Manual installation:

  ```shell
  psql teledrive < ./server/src/model/migrations/dump.20220406.sql
  ```

  **Note.** *Change `teledrive` with your database name.*

- Docker installation:

  ```shell
  cd docker
  docker container exec -i $(docker-compose ps -q db) psql -U postgres teledrive < ../server/src/model/migrations/dump.20220406.sql
  ```

- Heroku:

  ```shell
  heroku pg:psql --app YOUR_APP_NAME -f ./server/src/model/migrations/dump.20220406.sql
  ```

  **Note.** *Change `YOUR_APP_NAME` to your application name.*

### 4. Rebuild and run

Select how you deploy your application to rebuild the application:

- Manual installation:

  ```shell
  yarn install
  yarn workspaces run build
  cd server && node dist/index.js
  ```

- Docker installation:

  ```shell
  cd docker
  docker-compose down
  docker-compose up --build --force-recreate -d
  docker image prune -f   # remove dangling images
  ```

- Heroku:

  ```shell
  git push heroku main
  ```

- Vercel:

  ```shell
  yarn install
  yarn workspaces run build
  vercel --prod
  ```

## Frequiently Asked Questions

*Q: How to change the default port?*

A: You can change the default port by update/add `PORT=80` to your `server/.env` file if you installed manually. Or, in `docker/.env` file if you installed with Docker. Then, you need to [rebuild](#4-rebuild-and-run) the application to apply the changes.