Add docker-compose.yml

This commit is contained in:
Samuel Elliott 2022-05-30 13:26:05 +01:00
parent 9f63fc8359
commit e46d778dd0
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
5 changed files with 61 additions and 7 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
node_modules
dist
data
docker-compose.override.yml
.env
.vscode/schema

View File

@ -51,4 +51,5 @@
},
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.quoteStyle": "single",
}

51
docker-compose.yml Normal file
View File

@ -0,0 +1,51 @@
version: '3'
services:
web:
build: .
command: nso http-server --listen \[::]:80
restart: unless-stopped
labels:
traefik.enable: true
traefik.http.routers.nxapi-znc.entrypoints: websecure
traefik.http.routers.nxapi-znc.rule: Host(`${TRAEFIK_HOST:-nxapi.ta.fancy.org.uk}`) && PathPrefix(`/api/znc/`)
traefik.http.routers.nxapi-znc.tls: true
traefik.http.services.nxapi-znc.loadbalancer.server.port: 80
environment:
DEBUG: '*,-express:*'
ZNCA_API_URL: http://znca-api/api/znca
volumes:
- data:/data
znca-api:
image: ${COMPOSE_PROJECT_NAME:-nxapi}_web
command:
- android-znca-api-server-frida
- $ZNCA_API_ANDROID_DEVICE
- --exec-command
- ${ZNCA_API_EXEC_COMMAND:-}
- --frida-server-path
- ${ZNCA_API_FRIDA_SERVER_PATH:-/data/local/tmp/frida-server}
- --listen
- '[::]:80'
restart: unless-stopped
depends_on:
- web
labels:
traefik.enable: true
traefik.http.routers.nxapi-znca.entrypoints: websecure
traefik.http.routers.nxapi-znca.rule: Host(`${TRAEFIK_HOST:-nxapi.ta.fancy.org.uk}`) && PathPrefix(`/api/znca/`)
traefik.http.routers.nxapi-znca.tls: true
traefik.http.services.nxapi-znca.loadbalancer.server.port: 80
environment:
DEBUG: '*,-express:*,-body-parser:*'
volumes:
- data:/data
healthcheck:
test: [ "ENTRYPOINT", "curl", "http://[::1]:80" ]
timeout: 45s
interval: 10s
retries: 10
volumes:
data:

View File

@ -164,7 +164,7 @@ export class ZncNotifications extends Loop {
this.splatnet2_monitors.size ? 'user' : null,
]);
await this.updatePresenceForNotifications(user, friends);
await this.updatePresenceForNotifications(user, friends, this.data.user.id, false);
if (user) await this.updatePresenceForSplatNet2Monitors([user]);
}
@ -219,7 +219,8 @@ export class NotificationManager {
if (this.accounts.get(friend.nsaId) !== naid) continue;
if (lastpresence?.updatedAt !== friend.presence.updatedAt && !initialRun) {
debug('%s\'s presence updated', friend.name, new Date(friend.presence.updatedAt * 1000).toString());
debugFriends('%s\'s presence updated', friend.name,
new Date(friend.presence.updatedAt * 1000).toString());
}
let type: PresenceEvent | undefined = undefined;
@ -250,10 +251,10 @@ export class NotificationManager {
const lasttitle = lastpresence.game as Game;
debugFriends('%s is now offline%s, was playing title %s %s', friend.name,
debugFriends('%s is now offline%s, was playing title %s %s, logout time %s', friend.name,
friend.presence.state !== PresenceState.OFFLINE ? ' (console still online)' : '',
lasttitle.name, JSON.stringify(lasttitle.sysDescription),
new Date(friend.presence.logoutAt * 1000).toString());
friend.presence.logoutAt ? new Date(friend.presence.logoutAt * 1000).toString() : null);
if (friend.presence.state !== PresenceState.OFFLINE) {
// Friend's console is still online
@ -305,8 +306,7 @@ export class NotificationManager {
// Friend's console is now offline
type = PresenceEvent.STATE_CHANGE;
debugFriends('%s\'s console is now offline', friend.name,
new Date(friend.presence.logoutAt * 1000).toString());
debugFriends('%s\'s console is now offline', friend.name);
}
if (lastpresence?.updatedAt !== friend.presence.updatedAt && !initialRun) {

View File

@ -248,7 +248,7 @@ export class ZncDiscordPresence extends ZncNotifications {
}
}
await this.updatePresenceForNotifications(user, friends, this.data.user.id, true);
await this.updatePresenceForNotifications(user, friends, this.data.user.id, false);
if (user) await this.updatePresenceForSplatNet2Monitors([user]);
}