Compare commits
No commits in common. "d8d38e09085fea2ccb2dccaa27cf1b3336b4cad8" and "fc6593329b4339e0d0809fcdc35f83400a120e63" have entirely different histories.
d8d38e0908
...
fc6593329b
14
Dockerfile
14
Dockerfile
@ -1,14 +0,0 @@
|
|||||||
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
|
|
88
README.md
88
README.md
@ -1,23 +1,10 @@
|
|||||||
# GibCasa GameServerSupervisor
|
# GibCasa GameServerSupervisor
|
||||||
|
|
||||||
## Table of Contents
|
## Prerequisites
|
||||||
- [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
|
||||||
@ -35,80 +22,19 @@ 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
|
||||||
./manage.py migrate
|
python manage.py migrate
|
||||||
```
|
```
|
||||||
6. Create admin user:
|
6. Create admin user:
|
||||||
```bash
|
```bash
|
||||||
./manage.py createsuperuser
|
python manage.py createsuperuser
|
||||||
```
|
```
|
||||||
7. Run server:
|
7. Run server:
|
||||||
```bash
|
```bash
|
||||||
./manage.py runserver
|
python manage.py runserver
|
||||||
```
|
```
|
||||||
-------------
|
* visit http://localhost:8000 for /public and
|
||||||
|
|
||||||
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
|
http://localhost:8000/admin/ to login via the superuser credentials
|
||||||
|
* will need docker running
|
||||||
## 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,7 +3,6 @@ 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 %}GibCasa{% endblock %}</title>
|
<title>{% block title %}Game Server Supervisor{% 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 WIP</a>
|
<a href="https://liberta.casa/rules.html">Terms of Service</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,30 +16,16 @@
|
|||||||
</nav> -->
|
</nav> -->
|
||||||
|
|
||||||
<div class="game-detail">
|
<div class="game-detail">
|
||||||
<div class="game-box" style="width: 150px; text-align: center;">
|
<div class="game-image">
|
||||||
<a href="{% url 'game_detail' game.name %}">
|
<img src="{{ game.image_url }}" alt="{{ 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>Games</h2>
|
<h2>Public Game Servers</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 %}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
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"
|
|
||||||
|
|
3
webpanel/tests.py
Normal file
3
webpanel/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
@ -13,10 +13,4 @@ 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)
|
||||||
servers = Server.objects.filter(game=game)
|
return render(request, 'webpanel/game_detail.html', {'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