Skip to content

Commit 0d7cd64

Browse files
committed
Update self-hosting instructions
1 parent 5b2ca9b commit 0d7cd64

File tree

4 files changed

+29
-42
lines changed

4 files changed

+29
-42
lines changed

README.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**paste is a simple web app for writing & sharing code.** It's my own take on conventional pastebin sites like _pastebin.com_ or _hastebin_.
66

7-
Anyone can use paste! The official/public instance can be accessed using the endpoints listed below, but you can also [host your own](#host-your-own) if you like!
7+
Anyone can use paste! The official/public instance can be accessed using the endpoints listed below, but you can also [host your own](#self-hosting) if you like!
88

99
##### 1) In a Web Browser
1010
Just go to https://pastes.dev!
@@ -90,28 +90,13 @@ The API is powered by the [bytebin](https://github.com/lucko/bytebin) service, s
9090

9191
___
9292

93-
### Host your own
93+
### Self-hosting
9494

95-
It's quite simple to host your own version.
95+
The easiest way to self-host is using Docker (& Docker Compose). You can run the following commands to get started:
9696

9797
```bash
9898
git clone https://github.com/lucko/paste
9999
cd paste
100-
yarn install
101-
102-
# Outputs html/css/js files to /build
103-
yarn build
104-
105-
# Start a webserver for testing/development
106-
yarn start
107-
```
108-
109-
You can then follow the [create-react-app deployment documentation](https://create-react-app.dev/docs/deployment/) for how to host the build output. I personally recommend deploying to the cloud using a service like Netlify instead of hosting on your own webserver.
110-
111-
If you really want to self-host (including the bytebin data storage part), I suggest using Docker:
112-
113-
```bash
114-
git clone https://github.com/lucko/paste
115100
docker compose up -d
116101
```
117102

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
version: '3.8'
2-
31
services:
2+
3+
# frontend service
44
paste:
55
image: ghcr.io/lucko/paste
66

7+
# backend service
78
bytebin:
89
image: ghcr.io/lucko/bytebin
910
volumes:
1011
- data:/opt/bytebin/content
1112
environment:
1213
BYTEBIN_MISC_KEYLENGTH: 5
1314

15+
# reverse proxy
1416
nginx:
1517
image: nginx:alpine
1618
command: ['nginx', '-g', 'daemon off;']

docker/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ server {
1515
location ~ \.(?!html) {
1616
try_files $uri =404;
1717
}
18-
}
18+
}

docker/reverseproxy-nginx.conf

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# nginx reverse proxy configuration for paste+bytebin
1+
# nginx reverse proxy configuration for paste frontend & bytebin backend
22
server {
33
listen 80 default_server;
44

5-
# paste app
5+
# proxy / path to paste frontend
66
location / {
7-
proxy_set_header Host $host;
8-
proxy_set_header X-Real-IP $remote_addr;
9-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10-
proxy_set_header X-Forwarded-Host $server_name;
7+
proxy_set_header Host $host;
8+
proxy_set_header X-Real-IP $remote_addr;
9+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10+
proxy_set_header X-Forwarded-Host $server_name;
1111

12-
proxy_pass http://paste;
13-
}
12+
proxy_pass http://paste;
13+
}
1414

15-
# disable bytebin frontend
16-
location = /data/ {
17-
return 404;
18-
}
15+
# disable bytebin frontend
16+
location = /data/ {
17+
return 404;
18+
}
1919

20-
# proxy /data endpoint to bytebin
21-
location /data/ {
22-
proxy_set_header Host $host;
23-
proxy_set_header X-Real-IP $remote_addr;
24-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25-
proxy_set_header X-Forwarded-Host $server_name;
20+
# proxy /data path to bytebin backend
21+
location /data/ {
22+
proxy_set_header Host $host;
23+
proxy_set_header X-Real-IP $remote_addr;
24+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25+
proxy_set_header X-Forwarded-Host $server_name;
2626

27-
proxy_pass http://bytebin:8080/;
28-
}
29-
}
27+
proxy_pass http://bytebin:8080/;
28+
}
29+
}

0 commit comments

Comments
 (0)