diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md similarity index 94% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE/pull_request_template.md index f05d0511..b4576f42 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -1,9 +1,11 @@ # Pull Request ## Description + Please describe what the pull request implements/fixes. -## Commits +## Commits + Please keep commits easy-to-read and split up in smaller digestable chunks. That will make it easier to get an overview of what the code does. :+1: Thanks! diff --git a/Jenkinsfile b/Jenkinsfile index 5dc81093..2eee5f69 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,4 +23,9 @@ node('docker&&linux') { docker run --rm pilgrims/pilgrims-shared:${env.BRANCH_NAME} """ } -} \ No newline at end of file + stage('Remove Unused docker image') { + sh "docker rmi pilgrims/pilgrims-server:${env.BRANCH_NAME} || echo could not remove image" + sh "docker rmi pilgrims/pilgrims-client:${env.BRANCH_NAME} || echo could not remove image" + sh "docker rmi pilgrims/pilgrims-shared:${env.BRANCH_NAME} || echo could not remove image" + } +} diff --git a/README.md b/README.md index 601e4e31..52629e14 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ *** -# Play +# Play Run the following on a system that has Docker installed: @@ -16,20 +16,21 @@ Run the following on a system that has Docker installed: docker build -t pilgrims/pilgrims-server ./pilgrims-server docker-compose up -d -If you have a running traefik service you can access the app at pilgrims.localhost. +If you have a running traefik service you can access the app at pilgrims.localhost. Otherwise, run `docker inspect pilgrims-client | grep IPAddress` to find the ip address of the app. ![screenshot](doc/screenshot.png "Pilgrims") -# Implementation +## Implementation + [![Build Status](https://jenkins.anderswind.dk/buildStatus/icon?job=Pilgrims/master)](https://jenkins.anderswind.dk/job/Pilgrims/job/master/) [![codebeat badge](https://codebeat.co/badges/9fe73beb-c48f-4772-8d45-ab88e2241782)](https://codebeat.co/projects/github-com-awia00-pilgrims-master) [![Maintainability](https://api.codeclimate.com/v1/badges/e9e2a40371b22a5460ad/maintainability)](https://codeclimate.com/github/Awia00/Pilgrims/maintainability) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) -The server, shared libraries and client are all written in TypeScript and transpiled to JavaScript. The server runs in node, and the client is built using Vue. +The server, shared libraries and client are all written in TypeScript and transpiled to JavaScript. The server runs in node, and the client is built using Vue. -All modification on the game world are expressed in a monadic form, and will return a new game world when applied on the current world. -This gives us free "versioning" of the game world, gives us easy undo functionality and makes the real-time aspects of the game easier to work with and implement. +All modification on the game world are expressed in a monadic form, and will return a new game world when applied on the current world. +This gives us free "versioning" of the game world, gives us easy undo functionality and makes the real-time aspects of the game easier to work with and implement. Feel free to take a look at the code and throw a PR if you are missing any features/rules (there's plenty of expansions to the game that we haven't implemented - yet)! diff --git a/docker-compose.yaml b/docker-compose.yaml index a082fb7a..cefda668 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,24 +1,38 @@ -version: '3.5' +version: "3.5" services: + reverse-proxy: + container_name: traefik_pilgrims + image: traefik # The official Traefik docker image + command: --api --docker # Enables the web UI and tells Træfik to listen to docker + domainname: localhost + restart: unless-stopped + ports: + - "80:80" # The HTTP port + - "443:443" # The HTTP port + volumes: + - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events + networks: + traefik_proxy: + mongo: image: mongo volumes: - - ./data:/data/db + - pilgrims-mongo-data:/data/db labels: - - 'traefik.port=27017' - - 'traefik.enable=true' - - 'traefik.docker.network=traefik_proxy' - - 'traefik.backend=pilgrims-mongodb' - - 'traefik.frontend.rule=Host:pilgrims-db.localhost' + - "traefik.port=27017" + - "traefik.enable=true" + - "traefik.docker.network=traefik_proxy" + - "traefik.backend=pilgrims-mongodb" + - "traefik.frontend.rule=Host:pilgrims-db.localhost" pilgrims-client: image: pilgrims/pilgrims-client:latest restart: unless-stopped labels: - - 'traefik.enable=true' - - 'traefik.docker.network=traefik_proxy' - - 'traefik.backend=pilgrims-client' - - 'traefik.frontend.rule=Host:pilgrims.localhost' + - "traefik.enable=true" + - "traefik.docker.network=traefik_proxy" + - "traefik.backend=pilgrims-client" + - "traefik.frontend.rule=Host:pilgrims.localhost" networks: - traefik_proxy @@ -26,14 +40,17 @@ services: image: pilgrims/pilgrims-server:latest restart: unless-stopped labels: - - 'traefik.port=3000' - - 'traefik.enable=true' - - 'traefik.docker.network=traefik_proxy' - - 'traefik.backend=pilgrims-server' - - 'traefik.frontend.rule=Host:pilgrims-server.localhost' + - "traefik.port=3000" + - "traefik.enable=true" + - "traefik.docker.network=traefik_proxy" + - "traefik.backend=pilgrims-server" + - "traefik.frontend.rule=Host:pilgrims-server.localhost" networks: - traefik_proxy networks: traefik_proxy: external: true + +volumes: + pilgrims-mongo-data: diff --git a/pilgrims-client/.gitignore b/pilgrims-client/.gitignore deleted file mode 100644 index 185e6631..00000000 --- a/pilgrims-client/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -.DS_Store -node_modules -/dist - -# local env files -.env.local -.env.*.local - -# Log files -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw* diff --git a/pilgrims-client/Dockerfile b/pilgrims-client/Dockerfile index 535d325a..3e71a23e 100644 --- a/pilgrims-client/Dockerfile +++ b/pilgrims-client/Dockerfile @@ -21,7 +21,7 @@ RUN yarn install # Build app COPY . . -RUN npm run build +RUN yarn build # Runtime image FROM nginx:alpine diff --git a/pilgrims-client/package.json b/pilgrims-client/package.json index d6f8ccc2..b0c53618 100644 --- a/pilgrims-client/package.json +++ b/pilgrims-client/package.json @@ -9,40 +9,40 @@ "test:unit": "vue-cli-service test:unit" }, "dependencies": { - "@babel/polyfill": "^7.2.5", + "@babel/polyfill": "^7.8.7", "@types/socket.io-client": "^1.4.32", - "axios": "^0.18.0", - "honeycomb-grid": "^1.4.4", - "material-design-icons-iconfont": "^4.0.5", + "axios": "^0.19.2", + "honeycomb-grid": "^3.1.4", + "material-design-icons-iconfont": "^5.0.1", "pilgrims-shared": "file:../pilgrims-shared", - "pixi-viewport": "^3.21.1", - "pixi.js": "^4.8.6", - "register-service-worker": "^1.6.2", + "pixi-viewport": "^4.10.0", + "pixi.js": "^5.2.1", + "register-service-worker": "^1.7.1", "roboto-fontface": "*", - "socket.io-client": "^2.2.0", + "socket.io-client": "^2.3.0", "svg-pan-zoom": "github:ariutta/svg-pan-zoom", "svg.js": "^2.7.1", - "vue": "^2.6.7", - "vue-class-component": "^7.0.1", - "vue-property-decorator": "^7.3.0", - "vuetify": "^1.5.4", - "vuex": "^3.1.0" + "vue": "^2.6.11", + "vue-class-component": "^7.2.3", + "vue-property-decorator": "^8.4.1", + "vuetify": "^2.2.21", + "vuex": "^3.1.3" }, "devDependencies": { - "@types/jest": "^24.0.6", - "@types/pixi.js": "^4.8.6", - "@vue/cli-plugin-babel": "^3.4.1", - "@vue/cli-plugin-pwa": "^3.4.1", - "@vue/cli-plugin-typescript": "^3.4.1", - "@vue/cli-plugin-unit-jest": "^3.5.0", - "@vue/cli-service": "^3.4.1", - "@vue/test-utils": "^1.0.0-beta.29", + "@types/jest": "^25.2.1", + "@types/pixi.js": "^5.0.0", + "@vue/cli-plugin-babel": "^4.3.1", + "@vue/cli-plugin-pwa": "^4.3.1", + "@vue/cli-plugin-typescript": "^4.3.1", + "@vue/cli-plugin-unit-jest": "^4.3.1", + "@vue/cli-service": "^4.3.1", + "@vue/test-utils": "^1.0.0-beta.32", "babel-core": "7.0.0-bridge.0", - "node-sass": "^4.11.0", - "sass-loader": "^7.0.1", - "ts-jest": "^24.0.0", - "typescript": "^3.3.4000", - "vue-cli-plugin-vuetify": "^0.4.6", - "vue-template-compiler": "^2.6.7" + "sass": "^1.26.3", + "sass-loader": "^8.0.2", + "ts-jest": "^25.3.1", + "typescript": "^3.8.3", + "vue-cli-plugin-vuetify": "^2.0.5", + "vue-template-compiler": "^2.6.11" } } diff --git a/pilgrims-client/src/components/Map.vue b/pilgrims-client/src/components/Map.vue index 05faef58..eb75655c 100644 --- a/pilgrims-client/src/components/Map.vue +++ b/pilgrims-client/src/components/Map.vue @@ -13,7 +13,7 @@ import { Texture, Container, } from 'pixi.js'; -import Viewport from 'pixi-viewport'; +import { Viewport } from 'pixi-viewport'; import { World, Tile, @@ -322,7 +322,8 @@ export default class Map extends Vue { private SetupCanvas(): void { this.app = new Application({ - autoResize: true, + // TODO: This is unsupported in PIXI v4 and needs to be done differently: + // autoResize: true, resolution: 2, transparent: true, antialias: true, diff --git a/pilgrims-client/src/components/StartGame.vue b/pilgrims-client/src/components/StartGame.vue index 199929bc..7d432df2 100644 --- a/pilgrims-client/src/components/StartGame.vue +++ b/pilgrims-client/src/components/StartGame.vue @@ -1,82 +1,91 @@