Skip to content

Commit

Permalink
adding license, readme and build
Browse files Browse the repository at this point in the history
  • Loading branch information
KillahB33 committed Aug 18, 2024
1 parent a860241 commit aa4c90c
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 108 deletions.
13 changes: 0 additions & 13 deletions .codesandbox/tasks.json

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -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 }}
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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 . && \
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
43 changes: 28 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand All @@ -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
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
69 changes: 0 additions & 69 deletions web/README.md

This file was deleted.

21 changes: 14 additions & 7 deletions web/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<header className={classes.header}>
<Container size="md" className={classes.inner}>
<Text size="xl">SPT Manager</Text>
<Text>SPT v.{SPT_VERSION}</Text>
</Container>
</header>
<>
<Head>
<title>SPT Manager</title>
<meta name="Mod Manager for Single Player Tarkov" content="SPT Manager" />
</Head>
<header className={classes.header}>
<Container size="md" className={classes.inner}>
<Text size="xl">SPT Manager</Text>
<Text>SPT v{SPT_VERSION}</Text>
</Container>
</header>
</>
);
}
1 change: 0 additions & 1 deletion web/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down

0 comments on commit aa4c90c

Please sign in to comment.