Skip to content

Commit

Permalink
Uberserver in Docker (#397)
Browse files Browse the repository at this point in the history
* Add database for local server

* Add docker files for local server

* Add how to run local server with Docker
  • Loading branch information
a-pavlov authored Sep 25, 2023
1 parent c28d87e commit b142493
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,30 @@ $ ./server.py

# Logs
- `$PWD/server.log`

# Run local server via Docker
Build and run local server
```
$ cd docker
$ docker-compose build
$ docker-compose up
```
To obtain container id execute and search for uberserver
```
$ docker ps
```
Adding users. Directory will be /root/uberserver.
```
$ docker exec -it your_container_id bash
$ sqlite3 local_server.db
```
Add user to the database. Choose name you prefer to login. Role can be changed, see predefined values in the server code. Password will be 123. E-mail can be arbitrary, but uniq.
```
insert into users(username, password, register_date, ingame_time, access, email, bot) values ('user1', 'ICy5YqxZB1uWSwcVLSNLcA==', DATE('NOW'), 0, 'user', '[email protected]', 0);
```
Use your local machine address or find private uberserver address via Docker logs command
```
$ docker logs your_container_id
```
The address looks like "private: 192.168.100.17:8200"
For now you can login to local uberserver 192.168.100.17:8200 user/password user1/123
36 changes: 36 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:22.04
RUN apt-get update -y

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get install -y software-properties-common \
wget \
python3-pip \
python3-venv \
python3-dev \
build-essential \
libssl-dev \
libffi-dev \
make \
vim \
git \
openssl \
autogen \
libssl-dev \
less \
mysql-server \
libmysqlclient-dev \
libgeoip-dev \
default-libmysqlclient-dev \
pkg-config \
sqlite3

RUN cd /root && \
git clone https://github.com/a-pavlov/uberserver.git && \
cd uberserver && \
echo "GeoIP==1.3.2\n#mysqlclient==1.3.10\npyOpenSSL==23.0.0\nSQLAlchemy==1.3.0\nTwisted==22.10.0" > ./requirements.txt && \
pip install -r requirements.txt

WORKDIR "/root/uberserver"

ENTRYPOINT [ "./server.py", "-s", "sqlite:///local_server.db" ]
9 changes: 9 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3"

services:
app:
image: uberserver:latest
build: .
ports:
- "8200:8200"
network_mode: host
Binary file added local_server.db
Binary file not shown.

0 comments on commit b142493

Please sign in to comment.