Compare commits
13 Commits
fc6593329b
...
d8d38e0908
Author | SHA1 | Date | |
---|---|---|---|
d8d38e0908 | |||
0c44136f1a | |||
d6eb2a1b25 | |||
0b622ce3ea | |||
bfac5a22eb | |||
2e114fef44 | |||
e16a565c0c | |||
8251fecf9a | |||
07c1a2d8d6 | |||
9f82e689a1 | |||
9cec170f62 | |||
98b9574c67 | |||
7dc24f1456 |
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
|
ARG supervisor_dir="/usr/src/GameServerSupervisor"
|
||||||
|
|
||||||
|
RUN mkdir -p $supervisor_dir
|
||||||
|
|
||||||
|
WORKDIR $supervisor_dir
|
||||||
|
|
||||||
|
COPY . $supervisor_dir
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
EXPOSE 80
|
90
README.md
90
README.md
@ -1,10 +1,23 @@
|
|||||||
# GibCasa GameServerSupervisor
|
# GibCasa GameServerSupervisor
|
||||||
|
|
||||||
## Prerequisites
|
## Table of Contents
|
||||||
|
- [Installation using venv](#installation-using-venv)
|
||||||
|
- [Prerequisites](#prerequisites)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Installation using Podman](#installation-using-podman)
|
||||||
|
- [Prerequisites](#prerequisites-1)
|
||||||
|
- [Installation](#installation-1)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## Installation using venv
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
Python 3.10 or above
|
Python 3.10 or above
|
||||||
|
|
||||||
## Installation
|
### Installation
|
||||||
|
|
||||||
1. Clone the repository:
|
1. Clone the repository:
|
||||||
```bash
|
```bash
|
||||||
@ -22,19 +35,80 @@ Python 3.10 or above
|
|||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
5. Run tests:
|
||||||
|
```bash
|
||||||
|
./manage.py test
|
||||||
|
```
|
||||||
|
6. Run migrations:
|
||||||
|
```bash
|
||||||
|
./manage.py migrate
|
||||||
|
```
|
||||||
|
7. Create admin user:
|
||||||
|
```bash
|
||||||
|
./manage.py createsuperuser
|
||||||
|
```
|
||||||
|
8. Run server:
|
||||||
|
```bash
|
||||||
|
./manage.py runserver
|
||||||
|
```
|
||||||
|
## Installation using Podman
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
Podman
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone https://git.com.de/GibCasa/GameServerSupervisor
|
||||||
|
```
|
||||||
|
2. Build the image:
|
||||||
|
```bash
|
||||||
|
podman build . -t supervisor-image
|
||||||
|
```
|
||||||
|
3. Run a container in an interactive shell:
|
||||||
|
```bash
|
||||||
|
podman run -it --network=host localhost/supervisor-image sh
|
||||||
|
```
|
||||||
|
4. Run tests:
|
||||||
|
```bash
|
||||||
|
./manage.py test
|
||||||
|
```
|
||||||
5. Run migrations:
|
5. Run migrations:
|
||||||
```bash
|
```bash
|
||||||
python manage.py migrate
|
./manage.py migrate
|
||||||
```
|
```
|
||||||
6. Create admin user:
|
6. Create admin user:
|
||||||
```bash
|
```bash
|
||||||
python manage.py createsuperuser
|
./manage.py createsuperuser
|
||||||
```
|
```
|
||||||
7. Run server:
|
7. Run server:
|
||||||
```bash
|
```bash
|
||||||
python manage.py runserver
|
./manage.py runserver
|
||||||
```
|
```
|
||||||
* visit http://localhost:8000 for /public and
|
-------------
|
||||||
http://localhost:8000/admin/ to login via the superuser credentials
|
|
||||||
* will need docker running
|
To live sync host directory with container folder, in Step 3:
|
||||||
|
```bash
|
||||||
|
podman run --network=host -itv /host/src/path:/usr/src/GameServerSupervisor supervisor-image sh
|
||||||
|
```
|
||||||
|
`/host/src/path` is the absolute path to the repository in the host machine.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
* Visit http://localhost:8000 for /public and
|
||||||
|
http://localhost:8000/admin/ to login via the superuser credentials
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. Fork the repository.
|
||||||
|
2. Create a new branch: `git checkout -b feature-name`.
|
||||||
|
3. Make your changes.
|
||||||
|
4. Push your branch: `git push origin feature-name`.
|
||||||
|
5. Create a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the [AGPL](https://www.gnu.org/licenses/agpl-3.0.html).
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ certifi==2024.12.14
|
|||||||
charset-normalizer==3.4.1
|
charset-normalizer==3.4.1
|
||||||
Django==5.1.5
|
Django==5.1.5
|
||||||
idna==3.10
|
idna==3.10
|
||||||
|
pillow==11.2.1
|
||||||
podman==5.2.0
|
podman==5.2.0
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
sqlparse==0.5.3
|
sqlparse==0.5.3
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{% block title %}Game Server Supervisor{% endblock %}</title>
|
<title>{% block title %}GibCasa{% endblock %}</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -165,12 +165,12 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.game-box img {
|
/* .game-box img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
} */
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -189,14 +189,14 @@
|
|||||||
<a href="{% url 'games' %}">Games</a>
|
<a href="{% url 'games' %}">Games</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div class="navbar>
|
</div class="navbar">
|
||||||
<!-- <div class="right">
|
<!-- <div class="right"> -->
|
||||||
<div class="search-box">
|
<!-- <div class="search-box">
|
||||||
<input type="text" placeholder="Search...">
|
<input type="text" placeholder="Search...">
|
||||||
</div>
|
</div> -->
|
||||||
<a href="#">Auth / Settings</a> -->
|
<!-- <a href="#">Auth / Settings</a> -->
|
||||||
<!-- <div class="profile">Dp</div> -->
|
<!-- <div class="profile">Dp</div> -->
|
||||||
</div>
|
<!-- </div> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -205,7 +205,7 @@
|
|||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://ozFrags.net">Other Communities</a>
|
<a href="https://ozFrags.net">Other Communities</a>
|
||||||
<a href="https://liberta.casa/rules.html">Terms of Service</a>
|
<a href="https://liberta.casa/rules.html">Terms of Service WIP</a>
|
||||||
<a href="#">License: AGPLish</a>
|
<a href="#">License: AGPLish</a>
|
||||||
<a href="#">Contribute (WIP)</a>
|
<a href="#">Contribute (WIP)</a>
|
||||||
<a href="https://liberta.casa/gamja/#gibcasa">Support</a>
|
<a href="https://liberta.casa/gamja/#gibcasa">Support</a>
|
||||||
|
@ -16,16 +16,30 @@
|
|||||||
</nav> -->
|
</nav> -->
|
||||||
|
|
||||||
<div class="game-detail">
|
<div class="game-detail">
|
||||||
<div class="game-image">
|
<div class="game-box" style="width: 150px; text-align: center;">
|
||||||
<img src="{{ game.image_url }}" alt="{{ game.name }}">
|
<a href="{% url 'game_detail' game.name %}">
|
||||||
|
<img src="{{ game.thumbnail.url }}" alt="{{ game.name }}" style="width: 100%; height: auto;">
|
||||||
|
<p>{{ game.name }}</p>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="active-servers">
|
||||||
|
{% if active_servers %}
|
||||||
|
{% for server in active_servers %}
|
||||||
|
<fieldset class="server-box">
|
||||||
|
<legend>Server: {{ game.name }}</legend>
|
||||||
|
<div class="server-details">
|
||||||
|
<p><strong>IP Address:</strong> {{ server.ip_address }}</p>
|
||||||
|
<p><strong>Port:</strong> {{ server.port }}</p>
|
||||||
|
<p><strong>Status:</strong> Online</p>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p>No active servers found for this game.</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="game-info">
|
<div class="game-info">
|
||||||
<p>Pull data from some open API to populate information about the game and render it.</p>
|
<p>Pull data from some open API to populate information about the game and render it.</p>
|
||||||
<ul>
|
|
||||||
<li>🔹 <strong>Active:</strong> Non-full, non-empty servers with connection info, map, and player count</li>
|
|
||||||
<li>🔹 <strong>All Active:</strong> List of all active servers</li>
|
|
||||||
<li>🔹 <strong>Stopped:</strong> Available upon request</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% block title %}Games - Game Servers{% endblock %}
|
{% block title %}Games - Game Servers{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Public Game Servers</h2>
|
<h2>Games</h2>
|
||||||
|
|
||||||
<div class="game-grid" style="display: flex; flex-wrap: wrap; gap: 10px;">
|
<div class="game-grid" style="display: flex; flex-wrap: wrap; gap: 10px;">
|
||||||
{% for game in games %}
|
{% for game in games %}
|
||||||
|
11
webpanel/test_models.py
Normal file
11
webpanel/test_models.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
from webpanel.models import Game
|
||||||
|
|
||||||
|
class GameTestCase(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
Game.objects.create(name="Assassin's Creed")
|
||||||
|
|
||||||
|
def test_game_creation(self):
|
||||||
|
assassins = Game.objects.get(name="Assassin's Creed")
|
||||||
|
assert str(assassins) == "Assassin's Creed"
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
@ -13,4 +13,10 @@ def games(request):
|
|||||||
def game_detail(request, game_name):
|
def game_detail(request, game_name):
|
||||||
print(f"Looking for game: {game_name}")
|
print(f"Looking for game: {game_name}")
|
||||||
game = get_object_or_404(Game, name=game_name)
|
game = get_object_or_404(Game, name=game_name)
|
||||||
return render(request, 'webpanel/game_detail.html', {'game': game})
|
servers = Server.objects.filter(game=game)
|
||||||
|
for server in servers:
|
||||||
|
server.sync_status()
|
||||||
|
dormant_servers = servers.filter(status='offline')
|
||||||
|
active_servers = servers.filter(status='online')
|
||||||
|
return render(request, 'webpanel/game_detail.html', {'game': game,
|
||||||
|
'active_servers': active_servers, 'dormant_servers': dormant_servers})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user