Add docker compose and other files from cardgage

This commit is contained in:
Hamcha 2019-06-19 16:35:53 +02:00
parent f47cc0cd92
commit 891fe7c6f9
Signed by: hamcha
GPG key ID: A40413D21021EAEE
7 changed files with 180 additions and 1 deletions

4
.gitignore vendored
View file

@ -2,3 +2,7 @@ octgn-data
images images
*.exe *.exe
static static
.vagrant
ubuntu*.log
.vscode
rdb-data

26
.vagrantplugins Normal file
View file

@ -0,0 +1,26 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
class BuildCmd < Vagrant.plugin(2, :command)
def self.synopsis
"builds project on guest machine"
end
def execute
with_target_vms(nil, single_target: true) do |vm|
vm.action(:ssh_run, ssh_run_command: "cd /vagrant; docker-compose up -d --force-recreate")
end
end
end
class BuildProject < Vagrant.plugin(2)
name "Project builder"
command "build" do
BuildCmd
end
command "make-builder" do
MakeBuilder
end
end

15
Caddyfile Normal file
View file

@ -0,0 +1,15 @@
# Global rules
* {
tls off # Assume reverse proxy with TLS
gzip
root /static
proxy /api apigateway:80 {
transparent
without /api
websocket
}
cors /api {
allow_credentials true
allowed_headers Content-Type,Authorization
}
}

22
Dockerfile.publish Normal file
View file

@ -0,0 +1,22 @@
FROM golang:alpine AS builder
ARG MODULE_PATH
ENV GOPROXY https://modules.fromouter.space
ENV GO111MODULE=on
WORKDIR /app
# Get updated modules
COPY ./ ./
RUN go mod download
# Compile code
RUN CGO_ENABLED=0 go build -o /svc ./$MODULE_PATH
FROM scratch AS final
# Import the compiled executable from the first stage.
COPY --from=builder /svc /svc
CMD [ "/svc" ]

15
README.md Normal file
View file

@ -0,0 +1,15 @@
# Server tools
Tools and services needed for the MCG backend to work.
### draftbot
Bot for drafting MLP:CCG sets and cubes on MCG
### buildmap / convertsets / genpics
Tools for converting data/image packs from OCTGN to MCG/Cardgage
### webclient
Client for connecting to a Cardgage server and creating/joining test rooms

13
Vagrantfile vendored Normal file
View file

@ -0,0 +1,13 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v|
v.memory = 2048
end
config.vm.box = "ubuntu/cosmic64"
config.vm.network "private_network", ip: "192.168.22.23"
config.vm.provision "docker"
config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", rebuild: true, run: "always"
end

84
docker-compose.yml Normal file
View file

@ -0,0 +1,84 @@
version: "3"
services:
consul:
container_name: consul
image: consul:latest
command: consul agent -dev -log-level=warn -ui -client=0.0.0.0
hostname: consul
ports:
- "8500:8500"
networks:
- svc
caddy:
container_name: caddy
image: abiosoft/caddy
volumes:
- ./Caddyfile:/etc/Caddyfile
- ./images:/images
ports:
- "80:2015"
networks:
- svc
rdb:
container_name: rdb
image: rethinkdb:latest
volumes:
- rdb-data:/data
ports:
- "8000:8080"
networks:
- rdb
redis:
container_name: redis
image: redis:alpine
networks:
- redis
apigateway:
container_name: apigateway
image: moaorg/apigateway
depends_on:
- consul
networks:
- svc
lobbysvc:
container_name: lobbysvc
image: moaorg/cardgage-lobby
environment:
- "JWT_KEY=this-is-a-test-key"
- "WSS_HOST=ws://192.168.22.23/api/room"
volumes:
- ".:/app"
depends_on:
- consul
- redis
networks:
- svc
- redis
roomsvc:
container_name: roomsvc
image: moaorg/cardgage-room
environment:
- "JWT_KEY=this-is-a-test-key"
volumes:
- ".:/app"
depends_on:
- consul
- rdb
networks:
- svc
- rdb
volumes:
rdb-data:
networks:
svc:
rdb:
redis: