Sign inSign up

structs/structs-webapp

By structs

•Updated 3 days ago

The application layer of the Structs Guild Stack

Image
0

9.9K

structs/structs-webapp repository overview

⁠structs-webapp

The webapp for the front-end, back-end and API for Structs. It's a PHP 8.2 project using the Symfony 6.3 framework with Doctrine. This repo also contains the docker image which the webapp runs on. The docker image is running PHP 8.2 and apache and has Composer and Symfony installed on it. For easy development, the docker container has the /src directory bind mounted to the structs-webapp/src directory meaning the container reads the application files from your local machine and modifications to the files will show up in the container.

⁠Structs

In the distant future the species of the galaxy are embroiled in a race for Alpha Matter, the rare and dangerous substance that fuels galactic civilization. Players take command of Structs, a race of sentient machines, and must forge alliances, conquer enemies and expand their influence to control Alpha Matter and the fate of the galaxy.

⁠Setup

⁠1. Clone the repository

git clone https://github.com/playstructs/structs-webapp.git

⁠2. Build the docker image

docker build -t structs-webapp .

⁠3. Run the container

The image builds its JavaScript and asset manifest, which are not committed. The development Compose configuration mounts ./src over the image, so that mounted directory also needs npm ci and npm run build (from src/) before serving it. Use npm run dev for subsequent local development. For an existing deployment, prepare the complete release before switching the served directory; see asset deployment⁠.

docker compose up -d

To run the full stack (including Structs Consensus Engine), use docker compose -f docker-compose-full-stack.yml up -d or docker compose -f docker-compose-full-stack-arm64.yml up -d depending on your architecture.

⁠Connecting to the container

⁠1. Web Browser

http://localhost:8080/

⁠2. Bash

docker exec -it structs-webapp-app-1 bash

⁠Local development with a running container

Run the build from the src directory that Docker actually mounts. For this repository's Compose file, that is src/ in the checkout where Compose was started. The guild stack instead uses its configured WEBAPP_SOURCE directory. A second Git worktree has its own files: building there does not update a container mounted to the original checkout.

cd /path/to/structs-webapp/src
npm run dev

Leave this command running to rebuild after source edits, then refresh the browser. For a single production build, run npm run build in the same directory instead. Neither requires rebuilding or restarting the running container. This is webpack watch mode, not browser hot reload; an already-open page keeps its loaded code until refreshed.

Both commands write hashed bundles and public/js/manifest.json. The page reads the manifest on its next request; updating only the legacy public/js/index.js does not update the active entry. If a change does not appear, confirm the mounted source directory before clearing caches or rebuilding Docker:

docker inspect <webapp-container> --format '{{range .Mounts}}{{.Source}} -> {{.Destination}}{{println}}{{end}}'

⁠Learn more

⁠License

Copyright 2021 Slow Ninja Inc⁠.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0⁠

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Tag summary

Content type

Image

Digest

sha256:c2c18f551…

Size

361.5 MB

Last updated

3 days ago

docker pull structs/structs-webapp