Compare commits

...

8 Commits

Author SHA1 Message Date
Maxi Quoß 2d33ada47c npm update 2022-07-23 11:15:14 +02:00
Maxi Quoß bc5c9497a1 add reverse proxy to docker-comopse and readme 2022-07-23 11:13:46 +02:00
seriousm4x 6a472beaee Merge pull request #22 from jarrettgilliam/master
Add reverse proxy support
2022-07-23 11:05:52 +02:00
Jarrett Gilliam a34c419fd9 Use relative resource paths for better reverse proxy support
The app can now be proxied under a subfolder as well as a subdomain. Something like: http://example.com/upsnap/
2022-07-22 16:09:26 -05:00
Jarrett Gilliam 221cb86000 The frontend and backend can now be reverse proxied together 2022-07-22 14:45:50 -05:00
Jarrett Gilliam d4aac95fcd Ignore the JetBrains WebStorm .idea folder 2022-07-22 14:03:28 -05:00
Maxi Quoß 0f0a0ac98b define socket outside of func 2022-06-02 12:34:06 +02:00
Maxi Quoß 36cef610c3 add windows notice #20 2022-05-31 22:24:40 +02:00
11 changed files with 377 additions and 243 deletions
+3
View File
@@ -285,3 +285,6 @@ $RECYCLE.BIN/
.vscode
staticfiles
# JetBrains WebStorm
.idea/
+16
View File
@@ -34,10 +34,26 @@ There are 3 example docker-compose files to choose from. The simplest is [docker
The website will be available at [localhost:8000](http://localhost:8000). If you run it on a different pc, it will be `http://<your-ip>:8000`. You can change the port in the docker-compose file.
### Reverse Proxy
If you're using a reverse proxy, make sure to set `BACKEND_IS_PROXIED` to true in docker-compose. Set your reverse proxy to the `FRONTEND_PORT` and set `/wol/` to `BACKEND_PORT`.
**Caddy example**
```
upsnap.example.com {
reverse_proxy localhost:8000
reverse_proxy /wol/ localhost:8001
}
```
### Databases
Upsnap supports 3 different databases. Postgres, MySQL and SQLite. If you already have an existing database you want to use, delete the database container from the compose file. Always make sure to set the correct database type environment variable, e.g. DB_TYPE=mysql
### Windows
There is a partly working solution in the [issue here](https://github.com/seriousm4x/UpSnap/issues/20#issuecomment-1142593360). Windows has problems with docker networking mode host, which breaks network scan. Sending wol packages works though.
## 📝 Other infos
* The app container needs to run in host network mode to send the wakeonlan command on your local network. Therefore all other containers also need to run in host network mode. I don't like it but there is no way around.
+332 -236
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -6,12 +6,12 @@
<title>UpSnap</title>
<link rel='icon' type='image/png' href='/favicon.png'>
<link rel='stylesheet' href='/global.css'>
<link rel='stylesheet' href='/build/bundle.css'>
<link rel='icon' type='image/png' href='favicon.png'>
<link rel='stylesheet' href='global.css'>
<link rel='stylesheet' href='build/bundle.css'>
<script defer src='/build/bundle.js'></script>
<script defer src='/build/bootstrap.min.js'></script>
<script defer src='build/bundle.js'></script>
<script defer src='build/bootstrap.min.js'></script>
</head>
<body>
+1
View File
@@ -52,6 +52,7 @@ export default {
}),
replace({
BACKEND_PORT: JSON.stringify(process.env.BACKEND_PORT),
BACKEND_IS_PROXIED: JSON.stringify(!!process.env.BACKEND_IS_PROXIED),
preventAssignment: true
}),
// we'll extract any component CSS out into
+1 -1
View File
@@ -92,7 +92,7 @@
<nav class="navbar navbar-expand-sm">
<div class="container-fluid">
<div class="navbar-brand" href="/">
<img src="/favicon.png" alt="Logo" width="24" height="24" class="me-2">
<img src="favicon.png" alt="Logo" width="24" height="24" class="me-2">
UpSnap
</div>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
+10 -1
View File
@@ -4,9 +4,18 @@ import {
const status = writable('');
const message = writable('');
let socket;
function initSocket() {
const socket = new WebSocket(`ws://${location.hostname}:${BACKEND_PORT}/wol/`);
if (BACKEND_IS_PROXIED) {
const socketUrl = new URL('wol/', window.location.href);
socketUrl.protocol = socketUrl.protocol.replace('http', 'ws');
socket = new WebSocket(socketUrl);
}
else {
socket = new WebSocket(`ws://${location.hostname}:${BACKEND_PORT}/wol/`);
}
// Connection opened
socket.addEventListener('open', function () {
+1
View File
@@ -8,6 +8,7 @@ services:
environment:
- FRONTEND_PORT=8000
- BACKEND_PORT=8001
- BACKEND_IS_PROXIED=false # set this to true, if you use a reverse proxy
- DB_TYPE=mysql # required
- REDIS_HOST=127.0.0.1 # required (make sure to use the same ip as below)
- REDIS_PORT=6379 # required (make sure to use the same port as below)
+1
View File
@@ -8,6 +8,7 @@ services:
environment:
- FRONTEND_PORT=8000
- BACKEND_PORT=8001
- BACKEND_IS_PROXIED=false # set this to true, if you use a reverse proxy
- DB_TYPE=postgres # required
- REDIS_HOST=127.0.0.1 # required (make sure to use the same ip as below)
- REDIS_PORT=6379 # required (make sure to use the same port as below)
+1
View File
@@ -8,6 +8,7 @@ services:
environment:
- FRONTEND_PORT=8000
- BACKEND_PORT=8001
- BACKEND_IS_PROXIED=false # set this to true, if you use a reverse proxy
- DB_TYPE=sqlite # required
- REDIS_HOST=127.0.0.1 # required (make sure to use the same ip as below)
- REDIS_PORT=6379 # required (make sure to use the same port as below)
+6
View File
@@ -0,0 +1,6 @@
{
"name": "UpSnap",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}