From 79eaeca103b9fca8f2f7cf9b53a67a775a509016 Mon Sep 17 00:00:00 2001 From: HelixOW Date: Thu, 23 May 2024 23:52:33 +0000 Subject: [PATCH 1/3] Added devcontainer --- .devcontainer/devcontainer.json | 24 +++++++++++++++++++ .../docker-compose.devcontainer.yaml | 24 +++++++++++++++++++ .github/dependabot.yml | 12 ++++++++++ run.sh | 3 +++ 4 files changed, 63 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.devcontainer.yaml create mode 100644 .github/dependabot.yml create mode 100755 run.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..08fa695 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/go +{ + "name": "Go", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "dockerComposeFile": "./docker-compose.devcontainer.yaml", + "service": "dev", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}" + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "go version", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/docker-compose.devcontainer.yaml b/.devcontainer/docker-compose.devcontainer.yaml new file mode 100644 index 0000000..62d339c --- /dev/null +++ b/.devcontainer/docker-compose.devcontainer.yaml @@ -0,0 +1,24 @@ +services: + dev: + image: mcr.microsoft.com/devcontainers/go:1.22 + container_name: pokerogue-devcontainer-code + volumes: + - ../..:/workspaces:cached + network_mode: service:db + command: sleep infinity + depends_on: + - db + + db: + image: mariadb:11 + container_name: pokerogue-devcontainer-db + restart: on-failure + environment: + MYSQL_ROOT_PASSWORD: admin + MYSQL_DATABASE: pokeroguedb + MYSQL_USER: pokerogue + MYSQL_PASSWORD: pokerogue + ports: + - '3306:3306' + volumes: + - ../.data/db:/var/lib/mysql diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f33a02c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..1910a11 --- /dev/null +++ b/run.sh @@ -0,0 +1,3 @@ +# bin/bash +go build -o rogueserver +./rogueserver --debug --dbuser pokerogue --dbpass pokerogue & \ No newline at end of file From 5dd10031c299c940bbd4c8fa008354a5f1ff78f6 Mon Sep 17 00:00:00 2001 From: HelixOW Date: Fri, 24 May 2024 00:00:36 +0000 Subject: [PATCH 2/3] Added more doc --- README.md | 6 +++++- run.sh | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) delete mode 100755 run.sh diff --git a/README.md b/README.md index 2040c8e..bd1facb 100644 --- a/README.md +++ b/README.md @@ -80,4 +80,8 @@ Make sure that both 8000 and 8001 are portforwarded on your router. Test that the server's game and game authentication works from other machines both in and outside of the network. Once this is complete, enjoy! - +# Developing inside a Container: +If you are not aware of Devcontainer please see [here](https://code.visualstudio.com/docs/devcontainers/containers) +When you start up the container, a dev database is automatically created as well. +To run your application you can simply use +> go run rogueserver.go --debug --dbuser pokerogue --dbpass pokerogue diff --git a/run.sh b/run.sh deleted file mode 100755 index 1910a11..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -# bin/bash -go build -o rogueserver -./rogueserver --debug --dbuser pokerogue --dbpass pokerogue & \ No newline at end of file From f7ff04f4791a1def773e872394047034bc86bef9 Mon Sep 17 00:00:00 2001 From: HelixOW Date: Fri, 24 May 2024 00:04:42 +0000 Subject: [PATCH 3/3] Added even more doc --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index bd1facb..e66fa6d 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,7 @@ If you are not aware of Devcontainer please see [here](https://code.visualstudio When you start up the container, a dev database is automatically created as well. To run your application you can simply use > go run rogueserver.go --debug --dbuser pokerogue --dbpass pokerogue + +## Connecting to the frontend devcontainer +You can connect both devcontainer by using the host computer as a bridge. +(Default host ip: 172.17.0.1 OR host.docker.internal on MacOS / Linux) \ No newline at end of file