This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from mgilangjanuar/staging
Release v2.1.0
- Loading branch information
Showing
32 changed files
with
893 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ dist/ | |
build/ | ||
keys | ||
.env | ||
*.env | ||
.vercel | ||
lab/ | ||
sessions/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ ENV=develop | |
|
||
TG_API_ID= | ||
TG_API_HASH= | ||
ADMIN_USERNAME= | ||
|
||
DB_PASSWORD= | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
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: | ||
*Not needed. Automatically migrated after rebuild.* | ||
- 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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -f docker/.env ] | ||
then | ||
echo "Generating .env file..." | ||
|
||
ENV="develop" | ||
|
||
echo "Preparing your keys from https://my.telegram.org/" | ||
read -p "Enter your TG_API_ID: " TG_API_ID | ||
read -p "Enter your TG_API_HASH: " TG_API_HASH | ||
|
||
echo | ||
read -p "Enter your ADMIN_USERNAME: " ADMIN_USERNAME | ||
read -p "Enter your PORT: " PORT | ||
PORT="${PORT:=4000}" | ||
|
||
DB_PASSWORD=$(openssl rand -hex 18) | ||
API_JWT_SECRET=$(openssl rand -base64 36) | ||
FILES_JWT_SECRET=$(openssl rand -base64 36) | ||
|
||
echo "ENV=$ENV" > docker/.env | ||
echo "PORT=$PORT" >> docker/.env | ||
echo "TG_API_ID=$TG_API_ID" >> docker/.env | ||
echo "TG_API_HASH=$TG_API_HASH" >> docker/.env | ||
echo "ADMIN_USERNAME=$ADMIN_USERNAME" >> docker/.env | ||
echo "DB_PASSWORD=$DB_PASSWORD" >> docker/.env | ||
echo "API_JWT_SECRET=$API_JWT_SECRET" >> docker/.env | ||
echo "FILES_JWT_SECRET=$FILES_JWT_SECRET" >> docker/.env | ||
|
||
cd docker | ||
docker-compose up -d | ||
sleep 2 | ||
docker-compose up -d | ||
else | ||
git reset --hard | ||
git clean -f | ||
git pull origin main | ||
|
||
export $(cat docker/.env | xargs) | ||
|
||
cd docker | ||
docker-compose down | ||
docker-compose up --build --force-recreate -d | ||
sleep 2 | ||
docker-compose up -d | ||
|
||
docker image prune -f | ||
fi |
Oops, something went wrong.