diff --git a/.codesandbox/tasks.json b/.codesandbox/tasks.json deleted file mode 100644 index 98d6d78..0000000 --- a/.codesandbox/tasks.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // These tasks will run in order when initializing your CodeSandbox project. - "setupTasks": [], - - // These tasks can be run from CodeSandbox. Running one will open a log in the app. - "tasks": { - "npm run start": { - "name": "npm run start", - "command": "npm run start", - "runAtStart": true - } - } -} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..a3bf475 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,24 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + +env: + SPT_VERSION: 3.9.5 + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --build-arg SPT_VERSION=${{ env.SPT_VERSION }} --tag ghcr.io/killahb33/spt-manager:${{ env.SPT_VERSION }} + - name: Login to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Push Docker image + run: | + docker push ghcr.io/killahb33/spt-manager:${{ env.SPT_VERSION }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3fe3aee..194c685 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +# Set SPT Version +ARG SPT_VERSION=3.9.5 + # Base image with common dependencies FROM node:20.11.1-alpine AS base RUN apk update && \ @@ -9,8 +12,7 @@ RUN apk add git git-lfs # Fetch server components and build FROM git AS fetch -ARG SPT_VERSION=3.9.5 -ENV NEXT_PUBLIC_SPT_VERSION=${SPT_VERSION}} +ARG SPT_VERSION ARG GIT_CLONE_PROTECTION_ACTIVE=false WORKDIR /repo RUN git clone https://dev.sp-tarkov.com/SPT/Server.git . && \ @@ -28,6 +30,8 @@ RUN yarn run build:release # Build the Nextjs App FROM base AS builder +ARG SPT_VERSION +ENV NEXT_PUBLIC_SPT_VERSION=${SPT_VERSION} WORKDIR /app/web COPY web/package*.json ./ RUN npm install diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bd7c18a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2020 Blake Blackshear + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 17f44fc..e0c6871 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,30 @@ -# single-player-tarkov-docker -Private Dockerfile to build a docker container for Single-Player-Tarkov +# SPT Manager -[README на Русском языке](README_ru.md) +A management tool for your remote server hosted spt instance with a web management ui. -## Requirements +## Features -Debian or another Linux distr\ -Docker\ -git [LFS](https://git-lfs.github.com/) +- provide a web ui for server mod management +- add mod to your server using github link +- check if mod is latest and notify user if it isn't +- allow user to update to latest with the click of a button # Docker Support +## Docker Image + +The workflow will produce an image anytime and changes are pushed to main branch +You can download the image from ghcr.io/killahb33/spt-manager:${{ env.SPT_VERSION }} + ## Volumes -Two volumes are added: +Two volumes are added, a third being optional: - `/app/SPT_Data/Server` contains standard `SPT.Server` database and configuration files. For example, `http.json` or `profiles.json` The container will copy standard SPT Server files to this volume if emty (i.e. mounted by the very first time) - `/app/user` with the standard server configuration (will be created on first login) - `./profiles` contains the player profiles created - `./mods` installed server mods go here - `./logs` server logs will appear here +- `/app/BepInEx` this is the client side mods, mount this if you are planning to use [modsync](https://github.com/c-orter/modsync) ## Enviroment Variables - `SPT_LOG_REQUESTS` when false, disables SPT-AKI Request Logging @@ -34,16 +40,16 @@ The way SPT is organizing their release is by tags on release branches. 3.8.0 w Note: It can be a good idea to evolve the Dockerfile to include SPT_VERSION for the branch and always use latest tag) ```bash -git clone https://dev.sp-tarkov.com/Cbr/spt-docker.git -cd spt-docker -docker buildx build -f Dockerfile -t cbr/spt:latest ./ +git clone https://github.com/KillahB33/spt-manager.git +cd spt-manager +docker build -t killahb33/spt-manager:latest . ``` # Running ```bash -mkdir /opt/spt-aki && mkdir /opt/spt-aki/Server && mkdir /opt/spt-aki/user -docker run --name spt-aki -v /opt/spt-aki/Server:/app/SPT_Data/Server -v /opt/spt-aki/user:/app/user -e SPT_LOG_REQUESTS=false -e SPT_BACKEND_IP='External ip' -p 6969:6969 cbr/spt:latest -d +mkdir /opt/sptarkov && mkdir /opt/sptarkov/Server && mkdir /opt/tarkov/user +docker run --name spt-aki -v /opt/sptarkov/Server:/app/SPT_Data/Server -v /opt/sptarkov/user:/app/user -e SPT_LOG_REQUESTS=false -e SPT_BACKEND_IP='External ip' -p 6969:6969 cbr/spt:latest -d ``` Where "External IP" - this is the IP address you need - your external IP, local host IP address or received in the VPN network. @@ -59,5 +65,12 @@ Usually, minor version upgrades do work out of the box, but sometimes, mods fail --- Know issues: -`git-lfs` can fail because some regressions on git: https://github.com/git-lfs/git-lfs/issues/5749 -In that case we can add `ARG GIT_CLONE_PROTECTION_ACTIVE=false` when building so that the `alpine:git` intermediate container is able to fetch all the dependencies. + +- `git-lfs` can fail because some regressions on git: https://github.com/git-lfs/git-lfs/issues/5749 + - In that case we can add `ARG GIT_CLONE_PROTECTION_ACTIVE=false` when building so that the `alpine:git` intermediate container is able to fetch all the dependencies. +- the mod is only able to handle single asset releases, so if your mod has multiple assets in a release (not including source) then it can't handle it. + +Contributions: + +CBR - the original [spt-docker](https://dev.sp-tarkov.com/Cbr/spt-docker) creator which this project is heavily based on +Corter - [modsync](https://github.com/c-orter/modsync) creator and collaboration partner on how we can best help the spt community \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 10828c6..6eb8600 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ HOST_CONTAINER_IP=`awk 'END{print $1}' /etc/hosts` CONTAINER_IP=${HOST_CONTAINER_IP:-127.0.0.1} BACKEND_IP=${SPT_BACKEND_IP:-127.0.0.1} -export NEXT_PUBLIC_SPT_VERSION=${SPT_VERSION} +NEXT_PUBLIC_SPT_VERSION=${SPT_VERSION} echo "Replacing configuration with container ip_addr $CONTAINER_IP" diff --git a/web/README.md b/web/README.md deleted file mode 100644 index 37cfef7..0000000 --- a/web/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# SPT Manager - -A management tool for your remote server hosted spt instance with a web management ui. - -## Current features - -- provide a web ui for mod management -- add mod to your server using github link -- check if mod is latest notify user -- allow user to update mod - -# Docker Support - -## Volumes -Two volumes are added: -- `/app/SPT_Data/Server` contains standard `SPT.Server` database and configuration files. For example, `http.json` or `profiles.json` - The container will copy standard SPT Server files to this volume if emty (i.e. mounted by the very first time) -- `/app/user` with the standard server configuration (will be created on first login) - - `./profiles` contains the player profiles created - - `./mods` installed server mods go here - - `./logs` server logs will appear here - -## Enviroment Variables -- `SPT_LOG_REQUESTS` when false, disables SPT-AKI Request Logging -- `SPT_BACKEND_IP` when present, used in `http.conf` as `backendIp` property - -Feel free to play yourself with the different setups and configs. - -# How to build - -Update `SPT_VERSION` Dockerfile ARG with the desired tag -You can look for the most recent tag with `git describe --tags --abbrev=0` -The way SPT is organizing their release is by tags on release branches. 3.8.0 was not released as a tag on `master` as it was done before. -Note: It can be a good idea to evolve the Dockerfile to include SPT_VERSION for the branch and always use latest tag) - -```bash -git clone https://github.com/KillahB33/spt-manager.git -cd spt-manager -docker build -t killahb33/spt-manager:latest . -``` - -# Running - -```bash -mkdir /opt/sptarkov && mkdir /opt/sptarkov/Server && mkdir /opt/tarkov/user -docker run --name spt-aki -v /opt/sptarkov/Server:/app/SPT_Data/Server -v /opt/sptarkov/user:/app/user -e SPT_LOG_REQUESTS=false -e SPT_BACKEND_IP='External ip' -p 6969:6969 cbr/spt:latest -d -``` - -Where "External IP" - this is the IP address you need - your external IP, local host IP address or received in the VPN network. - -Additionally, a `compose.yml` file has been provided for the sake of convenience. - -# Upgrading from previous version - -Usually, minor version upgrades do work out of the box, but sometimes, mods fail to load giving errors. In that case, it is needed to delete `/user/cache` folder. - -- [ ] Evaluate if it's worth deleting the cache folder on server startup and its impact on server boot time. #todo - ---- - -Know issues: - -- `git-lfs` can fail because some regressions on git: https://github.com/git-lfs/git-lfs/issues/5749 - - In that case we can add `ARG GIT_CLONE_PROTECTION_ACTIVE=false` when building so that the `alpine:git` intermediate container is able to fetch all the dependencies. -- the mod is only able to handle single asset releases, so if your mod has multiple assets in a release (not including source) then it can't handle it. - -Contributions: - -CBR - the original [spt-docker](https://dev.sp-tarkov.com/Cbr/spt-docker) creator which this project is heavily based on \ No newline at end of file diff --git a/web/components/Header/index.tsx b/web/components/Header/index.tsx index 543fbbd..c43a1ce 100644 --- a/web/components/Header/index.tsx +++ b/web/components/Header/index.tsx @@ -1,15 +1,22 @@ -import { Container, Group, Text } from "@mantine/core"; +import { Container, Text } from "@mantine/core"; import classes from "./Header.module.css"; +import Head from 'next/head'; const SPT_VERSION = process.env.NEXT_PUBLIC_SPT_VERSION; export function Header() { return ( -
- - SPT Manager - SPT v.{SPT_VERSION} - -
+ <> + + SPT Manager + + +
+ + SPT Manager + SPT v{SPT_VERSION} + +
+ ); } diff --git a/web/pages/_app.tsx b/web/pages/_app.tsx index 57be103..9bcb8db 100644 --- a/web/pages/_app.tsx +++ b/web/pages/_app.tsx @@ -1,6 +1,5 @@ import '@mantine/core/styles.css'; import type { AppProps } from 'next/app'; -import Head from 'next/head'; import { MantineProvider } from '@mantine/core'; import { Header } from '../components/Header';