{"id":15042707,"url":"https://github.com/alghoshal/spaceship","last_synced_at":"2026-04-06T06:32:26.647Z","repository":{"id":254891396,"uuid":"847868802","full_name":"alghoshal/spaceship","owner":"alghoshal","description":"Game of battle between spaceships...","archived":false,"fork":false,"pushed_at":"2024-08-28T11:35:05.000Z","size":78,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T15:19:15.740Z","etag":null,"topics":["eureka","eureka-discovery-service","eureka-server","java","java-8","spring-actuator","spring-boot","spring-cloud","spring-service","spring-web"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alghoshal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-26T17:44:59.000Z","updated_at":"2024-11-24T20:38:31.000Z","dependencies_parsed_at":"2024-11-19T10:40:08.673Z","dependency_job_id":"e6553146-e414-4cd1-9ad1-1ad95064d9cd","html_url":"https://github.com/alghoshal/spaceship","commit_stats":null,"previous_names":["alghoshal/spaceship"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alghoshal/spaceship","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alghoshal%2Fspaceship","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alghoshal%2Fspaceship/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alghoshal%2Fspaceship/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alghoshal%2Fspaceship/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alghoshal","download_url":"https://codeload.github.com/alghoshal/spaceship/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alghoshal%2Fspaceship/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eureka","eureka-discovery-service","eureka-server","java","java-8","spring-actuator","spring-boot","spring-cloud","spring-service","spring-web"],"created_at":"2024-09-24T20:47:47.533Z","updated_at":"2026-04-06T06:32:26.629Z","avatar_url":"https://github.com/alghoshal.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spaceship Game\nA game of battle between fleets of spaceships owned by two (or more) opponents. \nThe game is written in Java-8 using Spring Boot and other Spring components. \nAll the game endpoints are accessible via REST Api's.\n\n## Requirements \u0026 Environment\n\tJava-8, Maven, Spring Boot-1.3.8, Spring Cloud, Eureka, Service, Web, Actuator  \n\n## To Build\n\tDownload spaceship repo which includes 3 projects: spaceship-core, spaceship-registry and spaceship-user. \n\t\n\tTo build go to the individual project folder \u0026 run mvn install\n\tE.g.:\tcd spaceship-registry\n\t\t\tmvn install\n\n\tBuild spaceship-core first then the other two projects, since the other two project depend on it\t\n\n## To Run\n\n\t1. In a terminal start the spaceship-registry spring-boot application from the spaceship-registry\n\tmvn spring-boot:run\n\t\n\t2.1. In a second terminal start the 1st player's instance (Defender)\n\tmvn spring-boot:run -Dserver.port=6000 -Dspring.application.instance_id=defender -Dmanagement.port=6001\n\t\n\t2.2 In a third terminal start the 2nd player's instance (Challenger)\n\tmvn spring-boot:run -Dserver.port=9000 -Dspring.application.instance_id=challenger -Dmanagement.port=9001\n\t\n\t\u0026 so on for the 3rd, 4th...Nth player's instances. \n\tJust remember to assign unique server.port, management.port and instance_id values to each player\n\n## Alternative: Build and Run using Docker\n\tDownload spaceship repo\n\n\t### Build spaceship-registry docker\n\tdocker build -t spaceship-registry -f DockerfileSpaceshipRegistry .\n\n\t### Start spaceship-registry instance\n\tdocker run --name spaceregistry -dp 8761:8761 --rm -it spaceship-registry:latest\n\t\n\t### Build spaceship-user docker\n\tdocker build -t spaceship-user -f DockerfileSpaceshipUser .\n\t\n\t### Start 1st spaceship-user instance on server_port 8000\n\tdocker run --name spaceuser1 -dp 8000:8000 -e server_port=8000 -e instance_id=user1 -e management_port=8001 --rm -it spaceship-user:latest\n\n\t### Start 2nd spaceship-user instance on server_port 9000 \n\tdocker run --name spaceuser2 -dp 9000:9000 -e server_port=9000 -e instance_id=user2 -e management_port=9001 --rm -it spaceship-user-1:latest\n\n## Various Service Endpoints\n\n\t* [/spaceship/user/game/{gameId}/fire],methods=[PUT],consumes=[application/json],produces=[application/json]\n\t* [/spaceship/user/game/{gameId}],methods=[GET],produces=[application/json]\n\t* [/spaceship/user/game/{gameId}/auto],methods=[POST]\n\t* [/spaceship/user/game/new],methods=[POST],consumes=[application/json],produces=[text/html]\n\t* [/ping],methods=[GET]\n\t* [/ping-2],methods=[PUT]\n\t* [/spaceship/protocol/game/new],methods=[POST],consumes=[application/json],produces=[application/json]\n\t* [/spaceship/protocol/game/{gameId}],methods=[PUT],consumes=[application/json],produces=[application/json]\n\t* [/spaceship/protocol/game/{gameId}/fire-back],methods=[PUT],consumes=[application/json],produces=[application/json]\n\n ## Sample API calls from using curl\n \n\t#Scenario-1:\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-1\",\"full_name\": \"Gamer Opponent\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9001}}' http://localhost:9000/spaceship/protocol/game/new\n\t# Special char in name\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-1\",\"full_name\": \"GäMer @pponent\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9001}}' http://localhost:9000/spaceship/protocol/game/new\n\t\n\t#Scenario-2:\n\tcurl -i -H \"Content-Type: application/json\" -X PUT -d '{\"salvo\": [\"0x0\", \"8x4\", \"DxA\", \"AxA\", \"7xF\"]}' http://localhost:6000/spaceship/protocol/game/23\n\t\n\t#Scenario-3:\n\tcurl -i -H \"Content-Type: application/json\" -X PUT -d '{\"salvo\": [\"0x0\", \"8x4\", \"DxA\", \"AxA\", \"7xF\"]}' http://localhost:6000/spaceship/user/game/33/fire\n\t\n\t#Scenario-4:\n\tcurl -i  http://localhost:6000/spaceship/user/game/abf-c\n\t\n\t#Scenario-5:\n\tcurl -i -H \"Content-Type: application/json\" -X POST http://localhost:6000/spaceship/user/game/lmn/auto\n\tcurl -i -X POST http://localhost:6000/spaceship/user/game/lmn/auto\n\t\n\t#Scenario-7: (~Case 1)\n\t\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-2\",\"full_name\": \"gamer Opponent\",\"rules\": \"6-shot\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9000}}' http://localhost:6000/spaceship/user/game/new\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-2\",\"full_name\": \"gamer Opponent\",\"rules\": \"super-charge\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9000}}' http://localhost:6000/spaceship/user/game/new\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-2\",\"full_name\": \"gamer Opponent\",\"rules\": \"desperation\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9000}}' http://localhost:6000/spaceship/user/game/new\n\t\n\t#Scenario-8:\n\tcurl -i -H \"Content-Type: application/json\" -X POST -d '{\"user_id\": \"gamer-2\",\"full_name\": \"gamer Opponent\",\"spaceship_protocol\": {\"hostname\": \"127.0.0.1\",\"port\": 9000}}' http://localhost:6000/spaceship/user/game/new\n\t\n\t# Ping GET\n\tcurl -i -H \"Content-Type: application/json\" -X GET http://localhost:9000/ping\n\t\n\t# Ping PUT\n\tcurl -i -H \"Content-Type: application/json\" -X PUT -d '{\"user_id\": \"x1\"}' http://localhost:9000/ping-2\n\t\n\t#XML:\n\tcurl -i -H \"Content-Type: text/xml\" -X PUT -d '\u003cdd\u003e\u003csalvo\u003ehi\u003c/salvo\u003e\u003c/dd\u003e' http://localhost:9000/spaceship/protocol/game/23\n\t# HTTP/1.1 415 Unsupported Media Type\n\t\t \t","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falghoshal%2Fspaceship","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falghoshal%2Fspaceship","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falghoshal%2Fspaceship/lists"}