{"id":18808549,"url":"https://github.com/dockboxhq/server","last_synced_at":"2025-10-16T21:22:15.606Z","repository":{"id":47557521,"uuid":"391277161","full_name":"dockboxhq/server","owner":"dockboxhq","description":"Go gin backend for dockbox","archived":false,"fork":false,"pushed_at":"2021-08-24T07:16:50.000Z","size":16034,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-12-29T21:45:28.552Z","etag":null,"topics":["docker","gin","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dockboxhq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-31T06:45:41.000Z","updated_at":"2021-08-28T05:23:46.000Z","dependencies_parsed_at":"2022-08-26T23:51:29.385Z","dependency_job_id":null,"html_url":"https://github.com/dockboxhq/server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockboxhq%2Fserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockboxhq%2Fserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockboxhq%2Fserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dockboxhq%2Fserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dockboxhq","download_url":"https://codeload.github.com/dockboxhq/server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239742438,"owners_count":19689315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker","gin","go"],"created_at":"2024-11-07T23:13:07.955Z","updated_at":"2025-10-16T21:22:15.514Z","avatar_url":"https://github.com/dockboxhq.png","language":"Go","readme":"# dockbox\n\nWelcome! This is the backend for `dockbox`, an application that gets you started quickly with on-the-go coding environments. Ever wanted to try out a library quickly before trying it out in your project? Have you ever stressed about having a lot of unwanted resources tied up on your machine? `dockbox` aims to solve these problems.\n\n\n## Server\n\nThe server is written in Go using the [Gin](https://github.com/gin-gonic/gin) framework. It supports and manages websocket connections from various client, and proxies websocket connections to the docker server\n\n### Prerequisites\nThe environment variables are loaded from `utils/config.go`. These values need to be defined in the local file before starting the server; otherwise, an error will be thrown. \n\nCurrently, the following values are required in a `.env` file in the root directory:\n\n```\ntype configType struct {\n\tENVIRONMENT        string\n\tPORT               string\n\tDOCKER_SERVER_HOST string\n\tDATABASE_NAME      string\n\tDATABASE_HOST      string\n\tDATABASE_PORT      string\n\tDATABASE_USER      string\n\tDATABASE_PASSWORD  string\n\tMOUNT_POINT        string\n}\n```\nNote: the mount point is where the user data will be stored. \n\nTo set up for production, the set up EC2 script can be used.\n\n### Architecture\n\nCurrently, these are the components in the architecture of the server:\n- Docker server(s)\n- Go server(s)\n- Mounted shared file system for each server\n- Database\n\n\nThe specifics of the architecture is implemented with AWS resources.\n\n- Servers: EC2 machines running Ubuntu 20.0.2\n- File System: EFS (Elastic File System)\n- Database: RDS (PostgreSQL) \n\nAlong with the above, the resources are running in a single VPC and spans multiple AZ in `us-east-1` (North Virginia). An Application Load Balancer (ALB) is used for load balancing and terminates SSL. An ALB instead of a classic Load Balancer was used since it supports WebSockets.\n\n\n### Functions\n \nCurrently, there is support for creating, retrieving, and connecting to a `dockbox`. A dockbox is an environment for your project, and contains details about the source repository; its ID can be used to connect a live websocket to it. \nFrom the UI, a dockbox would be a terminal window for the user.\n\nTo prevent the server from being overloaded, active containers need to managed properly. The ConnectionManager object takes care of the specifics, and is thread-safe. The server keeps track of the number of connections for each container, and once the number of connections for a specific container reaches 0, a new goroutine is spawned and the container is added to the deletion queue. Once the container is in the deletion queue for 1 minute, the container is stopped. \n\n\n\n## Credits\n- https://github.com/koding/websocketproxy\n- https://github.com/gin-gonic/gin\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockboxhq%2Fserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdockboxhq%2Fserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockboxhq%2Fserver/lists"}