{"id":13541784,"url":"https://github.com/nullpo-head/Out-of-the-Box-CodeServer","last_synced_at":"2025-04-02T09:32:35.657Z","repository":{"id":49193803,"uuid":"264631512","full_name":"nullpo-head/Out-of-the-Box-CodeServer","owner":"nullpo-head","description":"OOTB Code-Server is an out-of-the-box Code-Server environment. It provides Https proxy, GItHub authorization and automatic shutdown with just a few settings.","archived":false,"fork":false,"pushed_at":"2020-09-20T08:15:24.000Z","size":429,"stargazers_count":86,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T16:08:46.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/nullpo-head.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-17T09:53:44.000Z","updated_at":"2025-02-16T16:24:20.000Z","dependencies_parsed_at":"2022-09-01T22:01:45.700Z","dependency_job_id":null,"html_url":"https://github.com/nullpo-head/Out-of-the-Box-CodeServer","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/nullpo-head%2FOut-of-the-Box-CodeServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullpo-head%2FOut-of-the-Box-CodeServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullpo-head%2FOut-of-the-Box-CodeServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullpo-head%2FOut-of-the-Box-CodeServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullpo-head","download_url":"https://codeload.github.com/nullpo-head/Out-of-the-Box-CodeServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246788747,"owners_count":20834152,"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":[],"created_at":"2024-08-01T10:00:57.059Z","updated_at":"2025-04-02T09:32:35.368Z","avatar_url":"https://github.com/nullpo-head.png","language":"Shell","funding_links":[],"categories":["Extending ➕"],"sub_categories":[],"readme":"# OOTB Code-Server\n\nOOTB Code-Server is an out-of-the-box [Code-Server](https://github.com/cdr/code-server) environment.\n\n[Code-Server](https://github.com/cdr/code-server) is an OSS product developed by [Coder technologies](https://coder.com/) that allows you to run [VS Code](https://github.com/Microsoft/vscode) on any machine and to access it in the browser.  \nHowever, to install Code-Server on a server, you have to set up an Https proxy server, an authentication mechanism for security, automatic shutdown if the server is hosted in the cloud, and much more.  \nOOTB Code-Server provides these mechanisims with just a few settings.\n\nOOTB Code-Server is equipped with\n\n1. HTTPS powered by Let's Encrypt and [https-portal](https://github.com/SteveLTN/https-portal)\n2. Authorization by your GitHub account powered by [OAuth2 Proxy](https://github.com/oauth2-proxy/oauth2-proxy)\n3. Mutable LXC Code-Server container, inside which you can do any mutable things as you usually do in an Ubuntu machine\n4. Automatic deallocation of your VM after 15-minutes idle time (Currently Azure VM is supported)\n\nOOTB Code-Server consists of Docker-Compose containers for immutable components such as Https proxy and GitHub auth proxy,\nand a LXC container for mutable Code-Server environment.\n\n\u003cimg src=\"images/screenshot.png\" width=\"1366\"\u003e\n\u003cimg src=\"images/ootb-code-server-architecture.png\" width=\"518\"\u003e\n\n## Getting Started\n\n### 0. Prerequisites\n\nPlease install `docker`, `docker-compose`, and `lxd`. Ubuntu has `lxd` by default.\n\n### 1. Clone this repository\n\nPlease clone this repository to a good location\n\n```bash\n$ git clone https://github.com/nullpo-head/Out-of-Box-CodeServer-Environment.git ~/ootb-code-server\n```\n\n### 2. Set up environment variables\n\n1. Copy `.env.example` to `.env`\n\n   ```bash\n   $ cd ootb-code-server\n   $ cp ./helper_containers/.env.example ./helper_containers/.env\n   ```\n\n   Pleaes edit `.env` as follows\n\n2. DNS Name\n\n   Rewrite `CODER_HOST` to your server's DNS name. Let's Encrypt will issue a certificate for this domain.  \n   For example, if you use an Azure VM, it has a name like this\n\n   ```\n   CODER_HOST=my-ootb-codeserver.japaneast.cloudapp.azure.com\n   ```\n\n3. GitHub Authorization\n\n   Create a new OAuth App at https://github.com/settings/developers.  \n   \"Homepage URL\" is the domain you host your code-server. Let's suppose it's `https://yourdomain.com` here. Then, \"Authorization callback URL\" is `https://yourdomain.com/oauth2/callback`. Please note that you use `https://` because OOTB Code-Server enables https.\n   If you want to know more about this settings, please refer to [the doc of OAuth2 Proxy](https://oauth2-proxy.github.io/oauth2-proxy/)\n\n   Please fill in `OAUTH2_PROXY_CLIENT_ID` and `OAUTH2_PROXY_CLIENT_SECRET` in `.env` according to the app you created.\n\n   Put your email address in `emails` file. Only the email address listed here are allowed to login to your Code-Server.\n\n   ```bash\n   $ echo 'your.email.address@example.com' \u003e ~/ootb-code-server/helper_containers/emails\n   ```\n\n4. **(Optional)** Automatic Deallocation of Your VM (Azure is only supporeted)\n\n   If you enable automatic deallocation of your VM,\n   rewrite `HEARTBEATS_ACTION` so that it corresponds to your VM.\n\n   ```\n   HEARTBEATS_ACTION=\"az vm deallocate --subscription 'Put Your Subscription Here' -g 'Put Your Resource Group Name Here' -n 'Put Your VM Name Here\"\n   ```\n\n   You can set `HEARTBEATS_TIMEOUT` to determine how many minutes of idle time the VM will deallocate after. The default minutes is 15.  \n   By this configuration, your Azure VM is deallocated after Code-Server is idle for 15 minutes and there is no session of ssh and Bash for 15 minutes.\n\n   Azure VM is only supported right now because the author is an Azure user. Any PRs to support other clouds are welcome.\n   \n   __NOTE__: Automatic deallocation doesn't work if you connect to Code-Server from iPad. Please see [the issue of Code-Server](https://github.com/cdr/code-server/issues/2061).\n\n### 3. Initialize OOTB Code-Server\n\n**First**, please make sure that `80` and `443` ports are not used by other web servers.  \nInstalltion will fail if they are not available. If it fails, re-run `install.sh` after making those ports available.\n\nRun `install.sh`, following the instruction it prompts.\n\n```bash\n$ ./install.sh\n```\n\nAfter that, you can access your Code-Server at `https://your-host-name`.\n\nContainers of OOTB Code-Server will automatically launch when your server starts.\n\n## Stop / Start / Monitor Containers\n\nOOTB Code-Server consists of Docker Compose and LXD. So, you can controll containers by `docker-compose` and `lxc`.\n\n### Stop\n\n```bash\n$ lxc stop ootb-code-server\n$ cd ~/ootb-code-server/helper_containers\n$ sudo docker-compose stop  # or `down` to delete containers\n```\n\n### Start\n\nYou can start them again by\n\n```bash\n$ lxc start ootb-code-server\n$ cd ~/ootb-code-server/helper_containers\n```\n\n1. If you don't enable automatic VM deallocation,\n   ```bash\n   $ sudo docker-compose up -d https-portal oauth2-proxy\n   ```\n2. If you enable automatic VM deallocation,\n   ```bash\n   $ sudo docker-compose up -d\n   ```\n\nThey will launch automatically when your server launces, as long as they are running when you shutdown your server.\n\n### Monitor\n\nYou can monitor containers by\n\n```bash\n$ lxc ls\n+------------------+---------+---------------------+--------+------------+-----------+\n|       NAME       |  STATE  |        IPV4         |  IPV6  |    TYPE    | SNAPSHOTS |\n+------------------+---------+---------------------+--------+------------+-----------+\n| ootb-code-server | RUNNING | 10.238.18.27 (eth0) |        | PERSISTENT | 0         |\n+------------------+---------+---------------------+--------+------------+-----------+\n```\n\nand\n\n```bash\n$ cd ~/ootb-code-server/helper_containers\n$ sudo docker-compose ps\nCONTAINER ID        IMAGE                               COMMAND               CREATED             STATUS              PORTS                                      NAMES\n7c9806549c66        steveltn/https-portal:1             \"/init\"               2 hours ago         Up 2 hours          0.0.0.0:80-\u003e80/tcp, 0.0.0.0:443-\u003e443/tcp   helper_containers_https-portal_1\n6f0ce90981c9        quay.io/oauth2-proxy/oauth2-proxy   \"/bin/oauth2-proxy\"   2 hours ago         Up 2 hours                                                     helper_containers_oauth2-proxy_1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullpo-head%2FOut-of-the-Box-CodeServer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullpo-head%2FOut-of-the-Box-CodeServer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullpo-head%2FOut-of-the-Box-CodeServer/lists"}