diff --git a/README.md b/README.md index bbb7d52d..73f45187 100644 --- a/README.md +++ b/README.md @@ -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', 'user1@mail.com', 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 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..641037cb --- /dev/null +++ b/docker/Dockerfile @@ -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" ] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..1bc1cbb3 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3" + +services: + app: + image: uberserver:latest + build: . + ports: + - "8200:8200" + network_mode: host \ No newline at end of file diff --git a/local_server.db b/local_server.db new file mode 100644 index 00000000..5553318f Binary files /dev/null and b/local_server.db differ