Merge branch 'docker-server' into 'master'

Docker server

See merge request veloren/veloren!821
This commit is contained in:
Marcel 2020-02-27 21:43:17 +00:00
commit fa77646823
4 changed files with 90 additions and 12 deletions

View File

@ -8,7 +8,8 @@ variables:
stages:
- optional-builds
- check-compile
- post
- build-post
- publish
before_script:
- source $HOME/.cargo/env
@ -90,30 +91,30 @@ security:
# --
# -- post build
# -- build-post
unittests:
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- echo "Workaround, cargo tests fails due some rust files are already deleted, so we just stack cargo test. if its the os error, it wont appear on them all, if its a real error, it will retry and then fail"
- cargo test || cargo test || cargo test || cargo test
- cargo test || ( sleep 10 && cargo test ) || ( sleep 10 && cargo test ) || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test || cargo test
coverage:
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
tags:
- veloren-docker
script:
- echo "Workaround, tarpaulin fails due some rust files are already deleted, so we just stack tarpaulin. if its the os error, it wont appear on them all, if its a real error, it will retry and then fail"
- cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v
- cargo tarpaulin -v || ( sleep 10 && cargo tarpaulin -v ) || ( sleep 10 && cargo tarpaulin -v ) || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v || cargo tarpaulin -v
benchmarks:
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
tags:
@ -125,7 +126,7 @@ benchmarks:
localization-status:
variables:
GIT_DEPTH: 0
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
allow_failure: true
@ -135,13 +136,13 @@ localization-status:
- cargo test -q test_all_localizations -- --nocapture --ignored
linux:
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
@ -160,13 +161,13 @@ linux:
expire_in: 1 week
windows:
stage: post
stage: build-post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
@ -181,4 +182,53 @@ windows:
- assets/
- LICENSE
expire_in: 1 week
macos:
stage: build-post
when: delayed
start_in: 5 seconds
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
script:
- PATH="/dockercache/osxcross/target/bin:$PATH" COREAUDIO_SDK_PATH=/dockercache/osxcross/target/SDK/MacOSX10.13.sdk CC=o64-clang CXX=o64-clang++ cargo build --target x86_64-apple-darwin --release
- cp -r target/x86_64-apple-darwin/release/veloren-server-cli $CI_PROJECT_DIR
- cp -r target/x86_64-apple-darwin/release/veloren-voxygen $CI_PROJECT_DIR
artifacts:
paths:
- veloren-server-cli
- veloren-voxygen
- assets/
- LICENSE
expire_in: 1 week
# --
# -- publish
docker:
stage: publish
when: delayed
start_in: 5 seconds
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
dependencies:
- linux
before_script:
- ls "$CI_PROJECT_DIR/server-cli/"
only:
refs:
- /^r[0-9]+\.[0-9]+\.[0-9]+/
- /^v[0-9]+\.[0-9]+/
- /^master$/
tags:
- veloren-docker
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/server-cli/Dockerfile --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-server"
# --

8
server-cli/Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM debian:stable-slim
ARG PROJECTNAME=server-cli
COPY ./server-cli/docker-run.sh /opt/docker-run.sh
COPY ./veloren-server-cli /opt/veloren-server-cli
COPY ./assets/common /opt/assets/common
COPY ./assets/world /opt/assets/world

View File

@ -0,0 +1,17 @@
version: "3.7"
services:
game-server:
image: registry.gitlab.com/veloren/veloren:master-server
ports:
- "14004:14004"
- "14005:14005"
deploy:
replicas: 1
update_config:
parallelism: 2
delay: 10s
order: stop-first
failure_action: rollback
restart_policy:
condition: on-failure

3
server-cli/docker-run.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
cd /opt
RUST_LOG=info,common=debug,common::net=info RUST_BACKTRACE=1 /opt/veloren-server-cli