mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-11-28 12:53:04 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5a9a480d4 | |||
| ddbe52918c | |||
| ba806970a0 | |||
| 0d9f3ecb04 | |||
| 7c483d99c8 | |||
| 6b076b5009 | |||
| f8e1ede7cb | |||
| 4eecbe3cff | |||
| 78dd8e3b23 | |||
| 63d8e2c285 | |||
| 4571b46353 | |||
| 2d33ada47c | |||
| bc5c9497a1 | |||
| 6a472beaee | |||
| a34c419fd9 | |||
| 221cb86000 | |||
| d4aac95fcd | |||
| 0f0a0ac98b | |||
| 36cef610c3 |
@@ -285,3 +285,10 @@ $RECYCLE.BIN/
|
||||
|
||||
.vscode
|
||||
staticfiles
|
||||
|
||||
# JetBrains WebStorm
|
||||
.idea/
|
||||
|
||||
# custom
|
||||
docker-compose.yml
|
||||
db/
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ WORKDIR /app
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update &&\
|
||||
apt-get install -y --no-install-recommends default-mysql-client nodejs npm iputils-ping nmap samba-common-bin openssh-client sshpass &&\
|
||||
apt-get install -y --no-install-recommends default-mysql-client nodejs npm iputils-ping nmap samba-common-bin openssh-client sshpass curl &&\
|
||||
apt-get clean &&\
|
||||
rm -rf /var/lib/{apt,dpkg,cache,log}/
|
||||
COPY --from=python-build /opt/venv /opt/venv
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -116,7 +116,7 @@ elif os.getenv("DB_TYPE") == "sqlite":
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME" : "db.sqlite3",
|
||||
"NAME": "/app/backend/db/db.sqlite3",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,4 +174,4 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
VERSION = "v2.0.6"
|
||||
VERSION = "v2.2.3"
|
||||
|
||||
Generated
+332
-236
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^6.0.0",
|
||||
"@popperjs/core": "^2.11.5",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"bootstrap": "^5.1.3",
|
||||
"dotenv": "^16.0.0",
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
|
||||
<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/popper.min.js'></script>
|
||||
<script defer src='build/bootstrap.min.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -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.toLowerCase() === 'true'),
|
||||
preventAssignment: true
|
||||
}),
|
||||
// we'll extract any component CSS out into
|
||||
@@ -63,7 +64,9 @@ export default {
|
||||
src: [
|
||||
"node_modules/@fortawesome/fontawesome-free/webfonts",
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js",
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js.map"
|
||||
"node_modules/bootstrap/dist/js/bootstrap.min.js.map",
|
||||
"node_modules/@popperjs/core/dist/umd/popper.min.js",
|
||||
"node_modules/@popperjs/core/dist/umd/popper.min.js.map"
|
||||
],
|
||||
dest: "public/build/"
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
@@ -18,6 +19,8 @@ services:
|
||||
#- DJANGO_DEBUG=True # optional (default: False)
|
||||
#- DJANGO_LANGUAGE_CODE=de # optional (default: en)
|
||||
#- DJANGO_TIME_ZONE=Europe/Berlin # optional (default: UTC)
|
||||
volumes:
|
||||
- ./db/:/app/backend/db/
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
Reference in New Issue
Block a user