SphereCommunity

Full Version: docker & sphereserver - install tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Necessary things:
- hub.docker
- vps with docker or kubernetes
- git repository or local docker

My configuration:
BitBucket (git repository) -> pipeline -> hub.docker -> artificial ssh cmd -> deploy sh

File: Dockerfile
Code:
FROM amd64/ubuntu:19.04
MAINTAINER Martin Nakladal "ok2uec@gmail.com"

LABEL vendor1="Sphereserver"
LABEL vendor2="Ultima Online"

ENV DEBIAN_FRONTEND noninteractive

#RUN dpkg --add-architecture i386
RUN apt update && apt install -y libmysql++ libmysqlclient-dev unzip git gcc g++ make && rm -rf /var/lib/apt/lists/*
RUN mkdir /source
WORKDIR "/source"
RUN git clone https://github.com/SphereServer/Source.git
WORKDIR "/source/Source"
RUN make NIGHTLY=1
RUN rm -rf /source/Source/src
RUN rm -rf /source/Source/makefile
RUN chmod +x /source/Source/spheresvr

EXPOSE 2593
ENTRYPOINT ["/source/Source/spheresvr"]

DockerHub:
- create repository
- create pass for application in setting account

Pipeline bitbucket
file:bitbucket-pipelines.yml
Code:
image: atlassian/default-image:2

pipelines:
  default:
    - step:
        services:
          - docker
        script:  
          - export IMAGE_NAME=naklma/sphereserver:v$BITBUCKET_COMMIT
          - docker build -t $IMAGE_NAME .
          - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
          - docker push $IMAGE_NAME
repository variable $DOCKER_HUB_USERNAME
repository variable $DOCKER_HUB_PASSWORD

VPS server:
in terminal:
- docker login
(auth you login)

Code:
mkdir  /sphereserver
mkdir /sphereserver/data

over FTP copy folder & file:
- accounts  logs  mul  save  scripts  sphereCrypt.ini  sphere.ini

test:
ls -al /sphereserver/data

Modify sphere.ini
ServIP=127.0.0.1
ServPort=2593
RestAPIPublicIP=checkip.amazonaws.com


Code:
docker network create --driver=bridge --subnet=192.168.100.0/16 --gateway 192.168.100.1 sphereserver

docker run -d \
  -it \
  -p 2593:2593/tcp \
  -p 2593:2593/udp \
  --ip 192.168.100.2 \
  --hostname sphereserver \
  --net sphereserver \
  --restart unless-stopped \
  --name sphereserver \
  --mount type=bind,source=/sphereserver/data/accounts,target=/source/Source/accounts \
  --mount type=bind,source=/sphereserver/data/logs,target=/source/Source/logs \
  --mount type=bind,source=/sphereserver/data/mul,target=/source/Source/mul \
  --mount type=bind,source=/sphereserver/data/save,target=/source/Source/save \
  --mount type=bind,source=/sphereserver/data/scripts,target=/source/Source/scripts \
  --mount type=bind,source=/sphereserver/data/sphere.ini,target=/source/Source/sphere.ini \
  --mount type=bind,source=/sphereserver/data/sphereCrypt.ini,target=/source/Source/sphereCrypt.ini \
  naklma/sphereserver:vcf0bb2976eded224f51e03a1fb0107939b426733

try to log in .. it should go ..

Firewall enable port 2593 !!! in/out


Auxiliary commands:
docker exec -it <containerIDorNAME> bash
------
docker logs <containerIDorNAME>
------
docker container stop sphereserver
docker container rm sphereserver
Nice work! Thx
Reference URL's