Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 57e7c59

Browse files
committed
Update README to reflect repo move
1 parent 24437c9 commit 57e7c59

File tree

1 file changed

+147
-147
lines changed

1 file changed

+147
-147
lines changed

README.md

Lines changed: 147 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,147 @@
1-
# TempFiles Backend
2-
[![GitHub](https://img.shields.io/github/license/carlgo11/tempfiles-backend?style=for-the-badge)](https://github.com/Carlgo11/TempFiles-backend/blob/master/LICENSE)
3-
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/carlgo11/tempfiles-backend?style=for-the-badge)](https://github.com/Carlgo11/TempFiles-backend/releases)
4-
[![Docker](https://img.shields.io/badge/Docker-Download-2496ed?style=for-the-badge&logo=docker&logoColor=fff)](https://hub.docker.com/r/carlgo11/tempfiles-backend)
5-
## API calls :mega:
6-
A list of available API calls can be found over at [Postman](https://documenter.getpostman.com/view/TzK2bEsi).
7-
8-
## Deployment via Docker Compose
9-
1. Set up a new directory for TempFiles
10-
```BASH
11-
mkdir /opt/tempfiles
12-
cd /opt/tempfiles
13-
```
14-
15-
1. Copy the resource files.
16-
Set up a virtual server config for nginx to use.
17-
```BASH
18-
mkdir resources
19-
curl https://raw.githubusercontent.com/Carlgo11/TempFiles-backend/master/resources/nginx.conf > nginx.conf
20-
curl https://raw.githubusercontent.com/Carlgo11/TempFiles-backend/master/resources/php.ini > php.ini
21-
```
22-
23-
1. Create a docker-compose.yml file.
24-
```BASH
25-
nano docker-compose.yml
26-
```
27-
28-
And paste in the following:
29-
```YAML
30-
version: '3.2'
31-
services:
32-
tmpfiles:
33-
image: carlgo11/tempfiles-backend
34-
ports:
35-
- "5392:5392"
36-
- "5393:5393"
37-
volumes:
38-
- ./resources/nginx.conf:/opt/docker/etc/nginx/vhost.conf:ro
39-
- ./resources/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
40-
restart: always
41-
```
42-
43-
1. Set up a second webserver as a reverse proxy for the docker container(s).
44-
_This can be done with Apache or Nginx. Here's an example config for Nginx:_
45-
```NGINX
46-
# API
47-
server {
48-
listen 443 ssl http2;
49-
server_name api.tempfiles.download;
50-
51-
ssl_certificate <certificate path>;
52-
ssl_certificate_key <certificate key path>;
53-
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
54-
55-
# 100M = Total file upload limit of 100 MegaBytes.
56-
client_body_buffer_size 128M;
57-
client_max_body_size 128M;
58-
59-
location / {
60-
proxy_pass http://127.0.0.1:5392;
61-
}
62-
}
63-
64-
# Download
65-
server {
66-
listen 443 ssl http2;
67-
server_name d.tempfiles.download;
68-
69-
ssl_certificate <certificate path>;
70-
ssl_certificate_key <certificate key path>;
71-
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
72-
73-
location / {
74-
proxy_pass http://127.0.0.1:5393;
75-
}
76-
}
77-
```
78-
79-
1. Run the container
80-
```BASH
81-
docker-compose up -d
82-
```
83-
84-
## Manual Deployment :desktop_computer:
85-
Installation can also be done without using Docker.
86-
Here's how to set up TempFiles-Backend directly on a Linux server:
87-
88-
1. Install PHP, Nginx, Git, Composer
89-
```BASH
90-
sudo apt update
91-
sudo apt upgrade
92-
sudo apt install nginx php php-fpm composer php-curl php-mbstring git
93-
```
94-
95-
1. Download the source code
96-
```BASH
97-
git clone https://github.com/Carlgo11/Tempfiles-backend.git
98-
cd Tempfiles-backend/
99-
```
100-
101-
1. Download dependencies
102-
```BASH
103-
composer install --no-dev
104-
```
105-
106-
1. Set file path
107-
```BASH
108-
nano src/com/carlgo11/tempfiles/config.php
109-
```
110-
Change `'file-path'` to a suitable directory and create said directory.
111-
```BASH
112-
mkdir /tempfiles # file path directory
113-
chown www-data:www-data /tempfiles -R
114-
chmod 0700 /tempfiles -R
115-
```
116-
117-
1. Copy the Nginx configurations to the sites-available directory.
118-
```BASH
119-
cp ./ressouces/nginx/*.conf > /etc/nginx/sites-available/
120-
```
121-
122-
1. Generate certificates.
123-
For HTTPS to work you'll need a certificate. Due to the many different certificate companies and their different ways of generating certificates I won't go into that in this text.
124-
When you have a certificate, change the following lines in both nginx configs:
125-
```BASH
126-
nano /etc/nginx/sites-available/*.conf
127-
```
128-
```NGINX
129-
ssl_certificate {path_to_cert}/cert.pem; #Change path
130-
ssl_certificate_key {path_to_key}/privkey.pem; #Change path
131-
```
132-
133-
1. Restart Nginx
134-
```BASH
135-
sudo systemctl restart nginx
136-
```
137-
138-
## Environment variables
139-
|Name|Default Value|Type|Description|
140-
|----|-------------|----|-----------|
141-
|TMP_PATH|/tmp/tempfiles|String|Path where encrypted files should be saved to|
142-
|TMP_MAX_SIZE|128M|String|Max file size|
143-
|TMP_ENCRYPTION_ALGO|aes-256-gcm|String|File encryption algorithm|
144-
|TMP_STORAGE_METHOD|File|String|Storage method. Available methods are: File, MySQL|
145-
|TMP_HASH_COST|10|Integer|Bcrypt hashing cost. Only used for hashing deletion password.|
146-
|TMP_DOWNLOAD_URL|https://d.carlgo11.com/%1$$s/?p=%2$$s|String|URL where the user can download the file. `%1$$s`=ID `%2$$s`=Password|
147-
|TMP_404_URL|https://tempfiles.download/download/?404=1|String|URL to redirect to if a file can't be downloaded.|
1+
# TempFiles Backend
2+
[![GitHub](https://img.shields.io/github/license/tempfiles-download/Backend?style=for-the-badge)](https://github.com/tempfiles-download/Backend/blob/master/LICENSE)
3+
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/tempfiles-download/Backend?style=for-the-badge)](https://github.com/tempfiles-download/Backend/releases)
4+
[![Docker](https://img.shields.io/badge/Docker-Download-2496ed?style=for-the-badge&logo=docker&logoColor=fff)](https://hub.docker.com/r/tempfiles/backend)
5+
## API calls :mega:
6+
A list of available API calls can be found over at [Postman](https://documenter.getpostman.com/view/TzK2bEsi).
7+
8+
## Deployment via Docker Compose
9+
1. Set up a new directory for TempFiles
10+
```BASH
11+
mkdir /opt/tempfiles
12+
cd /opt/tempfiles
13+
```
14+
15+
1. Copy the resource files.
16+
Set up a virtual server config for nginx to use.
17+
```BASH
18+
mkdir resources
19+
curl https://raw.githubusercontent.com/tempfiles-download/Backend/master/resources/nginx.conf > nginx.conf
20+
curl https://raw.githubusercontent.com/tempfiles-download/Backend/master/resources/php.ini > php.ini
21+
```
22+
23+
1. Create a docker-compose.yml file.
24+
```BASH
25+
nano docker-compose.yml
26+
```
27+
28+
And paste in the following:
29+
```YAML
30+
version: '3.2'
31+
services:
32+
tmpfiles:
33+
image: tempfiles/backend
34+
ports:
35+
- "5392:5392"
36+
- "5393:5393"
37+
volumes:
38+
- ./resources/nginx.conf:/opt/docker/etc/nginx/vhost.conf:ro
39+
- ./resources/php.ini:/usr/local/etc/php/conf.d/php.ini:ro
40+
restart: always
41+
```
42+
43+
1. Set up a second webserver as a reverse proxy for the docker container(s).
44+
_This can be done with Apache or Nginx. Here's an example config for Nginx:_
45+
```NGINX
46+
# API
47+
server {
48+
listen 443 ssl http2;
49+
server_name api.tempfiles.download;
50+
51+
ssl_certificate <certificate path>;
52+
ssl_certificate_key <certificate key path>;
53+
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
54+
55+
# 100M = Total file upload limit of 100 MegaBytes.
56+
client_body_buffer_size 128M;
57+
client_max_body_size 128M;
58+
59+
location / {
60+
proxy_pass http://127.0.0.1:5392;
61+
}
62+
}
63+
64+
# Download
65+
server {
66+
listen 443 ssl http2;
67+
server_name d.tempfiles.download;
68+
69+
ssl_certificate <certificate path>;
70+
ssl_certificate_key <certificate key path>;
71+
ssl_ciphers 'CDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384';
72+
73+
location / {
74+
proxy_pass http://127.0.0.1:5393;
75+
}
76+
}
77+
```
78+
79+
1. Run the container
80+
```BASH
81+
docker-compose up -d
82+
```
83+
84+
## Manual Deployment :desktop_computer:
85+
Installation can also be done without using Docker.
86+
Here's how to set up TempFiles-Backend directly on a Linux server:
87+
88+
1. Install PHP, Nginx, Git, Composer
89+
```BASH
90+
sudo apt update
91+
sudo apt upgrade
92+
sudo apt install nginx php php-fpm composer php-curl php-mbstring git
93+
```
94+
95+
1. Download the source code
96+
```BASH
97+
git clone https://github.com/tempfiles-download/Backend.git
98+
cd Backend/
99+
```
100+
101+
1. Download dependencies
102+
```BASH
103+
composer install --no-dev
104+
```
105+
106+
1. Set file path
107+
```BASH
108+
nano src/com/carlgo11/tempfiles/config.php
109+
```
110+
Change `'file-path'` to a suitable directory and create said directory.
111+
```BASH
112+
mkdir /tempfiles # file path directory
113+
chown www-data:www-data /tempfiles -R
114+
chmod 0700 /tempfiles -R
115+
```
116+
117+
1. Copy the Nginx configurations to the sites-available directory.
118+
```BASH
119+
cp ./ressouces/nginx/*.conf > /etc/nginx/sites-available/
120+
```
121+
122+
1. Generate certificates.
123+
For HTTPS to work you'll need a certificate. Due to the many different certificate companies and their different ways of generating certificates I won't go into that in this text.
124+
When you have a certificate, change the following lines in both nginx configs:
125+
```BASH
126+
nano /etc/nginx/sites-available/*.conf
127+
```
128+
```NGINX
129+
ssl_certificate {path_to_cert}/cert.pem; #Change path
130+
ssl_certificate_key {path_to_key}/privkey.pem; #Change path
131+
```
132+
133+
1. Restart Nginx
134+
```BASH
135+
sudo systemctl restart nginx
136+
```
137+
138+
## Environment variables
139+
|Name| Default Value |Type|Description|
140+
|----|-------------------------------------------------|----|-----------|
141+
|TMP_PATH| /tmp/tempfiles |String|Path where encrypted files should be saved to|
142+
|TMP_MAX_SIZE| 128M |String|Max file size|
143+
|TMP_ENCRYPTION_ALGO| aes-256-gcm |String|File encryption algorithm|
144+
|TMP_STORAGE_METHOD| File |String|Storage method. Available methods are: File, MySQL|
145+
|TMP_HASH_COST| 10 |Integer|Bcrypt hashing cost. Only used for hashing deletion password.|
146+
|TMP_DOWNLOAD_URL| https://d.tempfiles.download/%1$$s/?p=%2$$s |String|URL where the user can download the file. `%1$$s`=ID `%2$$s`=Password|
147+
|TMP_404_URL| https://tempfiles.download/download/?404=1 |String|URL to redirect to if a file can't be downloaded.|

0 commit comments

Comments
 (0)