Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Release v2.0.0 (#290)
Browse files Browse the repository at this point in the history
* endgame

* disable subscribe button

* 2.0.0

* disable subscription check via env var

* install ts globally

* update .gitignore

* refactor docker-compose and Dockerfile

* Remove the -g from the typescript install as it doesn't work (#281)

Co-authored-by: M Gilang Januar <mgilangjanuar@gmail.com>

* update api base url in docker

* update postman link

* remove 402

* simplify installation and remove some pages

* init docs directory

* add docs page

* update config and assets url in docs

* update domain name

* update readme.md

Co-authored-by: X_Shadow_ <33694505+shadowdevfr@users.noreply.github.com>
  • Loading branch information
mgilangjanuar and shadowdevfr authored Mar 28, 2022
1 parent 6b39758 commit 56a690e
Show file tree
Hide file tree
Showing 56 changed files with 9,119 additions and 11,941 deletions.
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
.DS_Store
.vscode/
dist/
build/
Expand Down
17 changes: 10 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM node:14.19.0 as build
FROM node:16.14.0 as build
ARG NPM_TOKEN

WORKDIR /apps
COPY package.json .

COPY yarn.lock .
COPY ./package.json .
COPY package.json .
RUN echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc && \
echo "@mgilangjanuar:registry=https://npm.pkg.github.com/" >> ~/.npmrc && \
yarn install && \
rm -f ~/.npmrc
echo "@mgilangjanuar:registry=https://npm.pkg.github.com/" >> ~/.npmrc
# RUN npm i react-scripts -g --force --silent && \
# npm i typescript --force
RUN yarn install
RUN rm -f ~/.npmrc
COPY . .
RUN yarn workspaces run build
RUN yarn workspaces run build
126 changes: 2 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,136 +9,14 @@ This is the open source project of Google Drive/OneDrive/iCloud/Dropbox alternat
- [Google Photos ends the free storage service](https://www.techradar.com/news/google-photos-price)
- We deserve the free cloud storage service! Pricing: [Google Drive](https://one.google.com/about/plans), [OneDrive](https://one.google.com/about/plans), [Dropbox](https://www.dropbox.com/individual/plans-comparison), [iCloud](https://support.apple.com/en-us/HT201238)

## Requirements

- node ^14
- psql ^13
- redis ^5
- yarn

## Getting Started

- [Create Telegram application](https://core.telegram.org/api/obtaining_api_id)
- Create a Telegram bot for forwarding messages from the contact form to your Telegram with [BotFather](https://t.me/botfather)
- Install [Redis](https://redis.io/)
- Install the [PostgreSQL](https://www.postgresql.org/) as a database and sync the schema

```bash
yarn server typeorm schema:sync
```

or, with dump.sql:

```bash
psql db_name < ./server/src/model/migrations/dump.sql
```

- Setup environment variables

- Server variables

| env | required | description |
| ---------------------- | -------- | ------------------------------------------- |
| ENV | no | Hide the logs for production, default: develop |
| RPS | no | Rate limit API per second, default: 20 |
| TG_API_ID | yes | Application ID from your Telegram App |
| TG_API_HASH | yes | Application hash from Telegram App |
| TG_BOT_TOKEN | yes | Telegram bot token |
| TG_BOT_OWNER_ID | yes | Chat ID for sending messages to you |
| TG_BOT_ERROR_REPORT_ID | no | Chat ID for sending error, default: TG_BOT_OWNER_ID |
| DB_HOST | no | Database host URI, default: localhost |
| DB_NAME | yes | Database name |
| DB_PORT | no | Database port, default: 5432 |
| DB_USERNAME | yes | Database username |
| DB_PASSWORD | yes | Database password |
| GITHUB_TOKEN | yes | GitHub token for getting contributors |
| API_JWT_SECRET | yes | Random string for hashing auth token |
| FILES_JWT_SECRET | yes | Random string for encrypt public files |
| PAYPAL_CLIENT_ID | yes | Client ID for PayPal subscription |
| PAYPAL_CLIENT_SECRET | yes | Client secret for PayPal subscription |
| PAYPAL_PLAN_PREMIUM_ID | yes | Product ID for premium plan |
| REDIS_URI | no | Cache some responses from external services |
| UTILS_API_KEY | yes | Token key for make all servers communicate |

- Web variables

| env | required | description |
| ----------------- | -------- | -------------------------------------------------- |
| REACT_APP_API_URL | no | Base URL for the API, default: `''` (empty string) |

## Installation

### Docker

- Define environment variables in `./docker/.env`
- Run

```bash
docker-compose -f docker/docker-compose.yml up -d
```
- Open `teledrive.localhost` in browser

### Manual

- Define environment variables in `./server/.env` and `./web/.env`

- Create .npmrc in `~/.npmrc`
and add your GitHub personal token

```bash
# Copy these lines

//npm.pkg.github.com/:_authToken=yourtoken
@mgilangjanuar:registry=https://npm.pkg.github.com/
```
- Install dependencies

```bash
yarn install
```

- Build all

```bash
yarn workspaces run build
```

- Run

```bash
# All services will served in server with Express
yarn server node .
```

- Open `localhost:4000` *(default port: 4000)*

Or, if you want to run in the local environment:

- Build server

```bash
yarn server build -w
```

- Run server

```bash
yarn server start
```

- Run web

```bash
# Define the REACT_APP_API_URL in web/.env first, then
yarn web start

# Or, directly define the env
REACT_APP_API_URL=http://localhost:4000 yarn web start
```
Read here for full instructions: [teledriveapp.com](https://teledriveapp.com)

## API Documentation

[![Run in Postman](https://run.pstmn.io/button.svg)](https://documenter.getpostman.com/view/1778529/UV5TGf4u)
[![Run in Postman](https://run.pstmn.io/button.svg)](https://www.postman.com/restfireteam/workspace/mgilangjanuar/collection/1778529-3e4b0f8d-f721-4055-8d30-33cacaea93e6?ctx=documentation)

## How to Contribute

Expand Down
25 changes: 6 additions & 19 deletions docker/.env.example
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
NPM_TOKEN=your_github_token

# server configuration
ENV=production
RPS=
ENV=develop

TG_API_ID=
TG_API_HASH=
TG_BOT_TOKEN=
TG_BOT_OWNER_ID=
TG_BOT_ERROR_REPORT_ID=

DB_USERNAME=
DB_PASSWORD=

GITHUB_TOKEN=
API_JWT_SECRET=WDpojmXTH4ZPl3N2khUPPcAezLLpc8Mm
FILES_JWT_SECRET=nWHVW3arIdjC8Vy3g9rU2N6sKWmfPp7Z

API_JWT_SECRET=
FILES_JWT_SECRET=

PAYPAL_CLIENT_ID=
PAYPAL_CLIENT_SECRET=
PAYPAL_PLAN_PREMIUM_ID=

MIDTRANS_MERCHANT_ID=
MIDTRANS_CLIENT_KEY=
MIDTRANS_SERVER_KEY=

UTILS_API_KEY=
# web configuration
REACT_APP_TG_API_ID=
REACT_APP_TG_API_HASH=
29 changes: 6 additions & 23 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ services:
depends_on:
- app
app:
command: yarn server start
command: node server/dist/index.js
labels:
traefik.http.routers.server.rule: Host(`teledrive.localhost`)
traefik.port: 4000
ports:
- "4000:4000"
expose:
- 4000
build:
Expand All @@ -32,34 +34,15 @@ services:
environment:
DB_NAME: postgres
DB_HOST: db
DB_USERNAME: ${DB_USERNAME}
DB_USERNAME: postgres
DB_PASSWORD: ${DB_PASSWORD}
REDIS_URI: redis://cache
depends_on:
- db
- cache
db:
image: postgres:13
restart: always
environment:
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- ../server/src/model/migrations/dump.sql:/docker-entrypoint-initdb.d/dump.sql
# migration:
# command: yarn server typeorm schema:sync
# build:
# context: ../.
# dockerfile: Dockerfile
# args:
# NPM_TOKEN: ${NPM_TOKEN}
# environment:
# DB_NAME: postgres
# DB_HOST: db
# DB_USERNAME: ${DB_USERNAME}
# DB_PASSWORD: ${DB_PASSWORD}
# depends_on:
# - db
cache:
image: redis:6
restart: always
- ../server/src/model/migrations/dump.sql:/docker-entrypoint-initdb.d/dump.sql
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
teledriveapp.com
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
Loading

0 comments on commit 56a690e

Please sign in to comment.