Mob-code-server - Mob programming - a software development approach where the whole team works on the same thing

Screenshot


For those times when you need a ready to use server with a little more horse power, than your ipad provides.

Or better yet, when you need to Mob Program with friends! Mob programming is a software development approach where the whole team works on the same thing, at the same time, in the same space, and at the same computer.

This repository makes it possible to quickly deploy an EC2 (spot) instance running Code Server for just such a purpose.

This setup is CHEAP! The default configurations cost less than a $1USD per day in US regions.

It works equally well if you are on an iPad, Linux box - or behind terrible internet preventing you from developing as fast as you desire.

Or better yet, never deal with machine setup again when you onboard a team member.

Through configuration, this project:

  • provision and manage local SSH keys, and .ssh/config file, for rapid access to the server.
  • provision and manage a gitlab SSH key
  • setup code server, with real/validated LetsEncrypt certificates
  • expose the server using real DNS names
  • check out your code repositories (if specified in the configuration file)

    and commits any uncommitted changes upon destruction of the server.

foot note: this is derivative work by awesome open source projects from:

  • pulumi.com
  • coder.com

check `em out

I love this project, I hope you do too.

Screenshot

Prerequisites

Quick Start

  • Make sure the go modules are available

    export AWS_ACCESS_KEY_ID=<YOUR_ACCESS_KEY_ID>
    export AWS_SECRET_ACCESS_KEY=<YOUR_SECRET_ACCESS_KEY>
    export AWS_REGION=<YOUR_DESIRED_REGION>
    go mod tidy
    go mod vendor
  • Make a Pulumi stack

    This is important, as the secrets below will be tied to the stack - and only available to you for that stack.

    make stack
    

Setup your Configuration

Mandatory Values

You must set at a minimum the following configuration values

  • settings.hosted_zone - your AWS hosted zone (prerequisite)
  • settings.email - your email for LetsEncrypt Certificate
  • settings.gitlab.enabled - must be set (until github is supported)
  • settings.gitlab.username - your username for git configuration
  • settings.gitlab.token - a gitlab personal token used to manage the SSH cert for the new machine

All values (include optional values)

The following example shows all optional values.

cd cmd
CONFIG_FILE="../config/configuration.yml"
## Setup the zone info
pulumi config --config-file ${CONFIG_FILE} set aws:region us-west-2
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.hosted_zone' example.com
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.email' [email protected]

## Define the machine profile
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.hostname' seattle
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.vpc_id' vpc-ABCDIDREFESSDF
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.username' coder
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.instance_type' t3a.large
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.os_dist' ubuntu
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.disk_size' 128
# Setup creds locally (if you don't set these a new cert will be generate)
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.instance.credentials.public' "ssh-ed25519 YOUR KEY HERE..."
# Now setup the private cert - must be base64 (This will be used to provision post deployment)
PRIVATECERT=$(cat ~/.ssh/code-server.rsa | base64)
pulumi config --config-file ${CONFIG_FILE} set --secret --path 'settings.instance.credentials.private' "${PRIVATECERT}"

## Setup your github creds
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.github.enabled' false

## Setup your gitlab creds
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.gitlab.enabled' true
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.gitlab.username' mygitlabusername
pulumi config --config-file ${CONFIG_FILE} set --secret --path 'settings.gitlab.token' "glpat-SECRET_TOKEN"

## Setup some repositories to pull on build of the server
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.gitlab.repositories[0]' "[email protected]:myorg/some-cool-project.git"
pulumi config --config-file ${CONFIG_FILE} set --path 'settings.gitlab.repositories[1]' "[email protected]:myorg/another-cool-project.git"

Note when you are done - it is possible to commit this file (recommended on a brach - on a private fork). The values are encrypted by pulumi when using the --secret flag; which means only you can access these value.


Deploying the Server

make deploy

Example Deployment


Access the System

  • SSH to the machine to get the credentials

    Note that if you didn't provide an SSH certificate - one is created for you, and the .ssh/config file is configured accordingly.

    Next you will need the password for logging into your code server. The example below demonstrates this.

    $ ssh nomad.dev-jb.saas.getslim.ai cat /home/coder/.config/code-server/config.yaml
    
    The authenticity of host 'nomad.dev-jb.saas.getslim.ai (44.201.186.84)' can't be established.
    ECDSA key fingerprint is SHA256:vJdqoIhoPfsoxAQSbtQN3a3c/+THWZUJsq7ZdpusutE.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    Warning: Permanently added 'nomad.dev-jb.saas.getslim.ai,44.201.186.84' (ECDSA) to the list of known hosts.
    disable-telemetry: true
    link: false
    auth: password
    password: Mjk2NjBhY2E3Zjg4
  • Open your browser to your code server:

    open https://nomad.dev-jb.saas.getslim.ai
    

    Hints

    • On Mac/iPad you can save the tab to the desktop - which gives you a native VSCode experience.

    • On Linux - you can do a similar thing when using chrome.

    • Windows Users - you are on your own - I haven't touched a Windows box in about a decade.


Access Your Code Repositories

If you defined repositories in the configuration file, they will have been checked out to the /home/coder/code directory.


Shutdown (and Save the Planet)

This setup is so cheap, it is hard to complain about price - but energy usage costs more than just $$$.

Save our planet, and shut resources down when you are not using them. **No worries, this project will commit your code when you destroy the server (milage may very(tm)):

make destroy

Security Disclaimer

No effort has been put into making this secure more than random passwords, and using native pulumi encryption. That said, a lot can be done. If you find something (say something), and if I don't have cycles -I would love any PRs you post.

If you have cool ideas - don't be a stranger - Reach out!

Comments
  • Create or Lookup Spot Instance Service Linked Role

    Create or Lookup Spot Instance Service Linked Role

    What

    Need to create or lookup the Service Linked Role for Spot Instances.

    Why

    It is possible that the user has the service linked role define. It is also possible that the user has not defined the service linked role.

    Reproduction

    1. Create a brand new AWS account - with zero resources provisioned.
    2. Run make deploy per documentation

    Expected Results

    mob server is deployed and function

    Actual Results

    Error of missing Spot Instance Role.

  • fix cert generation and key file management

    fix cert generation and key file management

    ISSUE #3 Reference

    Why

    To prevent resource thrashing and recreation due to SSH key generation.

    What

    Used a combination of pulumi-tls and pulumi-command/local to control the generation and management of the SSH key. By using this approach we have pulumi manage the key and key state; which prevents from redeploys because the key used to be regenerated every time. Also - this simplifies the code (A+)

    How tested

    Ran the following sequence 3 times:

    make deploy
    

    Result

    • No change, no modification of resources on deployment
    • Key files deleted correctly on destroy
  • Redeploy trashing system when redeploy

    Redeploy trashing system when redeploy

    What

    When redeploying - the system is always torn down.

    Root Cause

    This is a result of the key generation is outside of the pulumi state.

    Reproduction

    1. make deploy
    2. make deploy

    Expected Behavior

    If no code has changed, or no extra scripts added - the system should not change. The deployment should do nothing to existing resources.

  • extra entries in .config file

    extra entries in .config file

    What

    Getting duplicate entries in .ssh/config file

    Reproduction

    1. don't specify certificate - allow app to generate and set .ssh/config file.
    2. make deploy
    3. make destroy
    4. make deploy
    5. cat .ssh/config

    Expected Results

    Single entry for server in .ssh/config

  • new repositories added to the config are not checked out

    new repositories added to the config are not checked out

    Expected Results

    When adding new repositories to the config, then redeploying, the new repositories are on the server

    Actual Results

    No new repositories are checked out

    Why this is important

    It is common to have a running config, which the user may change over time. ie. adding new repositories. This config should be the source of truth, and provide guidance on how to manage contents in the code server.

    Make sure it works - without hickups :)

  • Add support for github

    Add support for github

    What

    Add support for github; make this work for github users also.

    Why

    Many users have github accounts and don't use gitlab.

    How

    Extend the support methods in https://github.com/slim-ai/gitadm (all commands) In mob server init scripts, add a flag when checking out code.

The server-pubsub is the main backend of DATAVOC project that manages all the other web-server modules of the same project such as the processor

server-pubsub The server-pubsub is the main backend of DATAVOC project that manages all the other web-server modules of the same project such as the p

Dec 3, 2021
Go-web-dev - Web Development With Google's Golang Programming Language Code Snippet and Exercises.

Web Development With Google's Golang Programming Language Code Snippet and Exercises This repository contains my code snippets, hands on exercises and

Jan 16, 2022
webrpc is a schema-driven approach to writing backend services for modern Web apps and networks
webrpc is a schema-driven approach to writing backend services for modern Web apps and networks

webrpc is a schema-driven approach to writing backend servers for the Web. Write your server's api interface in a schema format of RIDL or JSON, and t

Jan 7, 2023
Transfer files between machines in the same network

GoTrans Transfer files from computer A to computer B. The program have a sender and a receiver, if you choose a sender you'll need to provide the ip a

Nov 7, 2021
Go-wd - Get the same working directory path at 'go run' and after 'go build'

go-wd Get the same working directory path at 'go run' and after 'go build' Usage

Jan 30, 2022
A repository for the X-Team community to collaborate and learn solutions to most coding challenges to help prepare for their interviews.
A repository for the X-Team community to collaborate and learn solutions to most coding challenges to help prepare for their interviews.

Community Coding Challenge Handbook This repository focuses on helping X-Teamers and community members to thrive through coding challenges offering so

Sep 6, 2022
Trello backend repo for Ladno Davayte Bez Roflov team

Trello Trello backend repository for Ladno Davayte Bez Roflov team, autumn of 2021. Team Anton Chumakov; Alexander Orletskiy; Georgij Sedojkin; Dmitri

Dec 25, 2021
It's an auxiliary tool ,and it helps the blue team track the attackers
It's an auxiliary tool ,and it helps the blue team track the attackers

pdog pdog -> Threat Intelligence pdog -> OSINT It's an auxiliary tool ,and it helps the blue team track the attackers Example useage: Usage: [comma

Dec 22, 2021
A robust Red Team proxy written in Go.

GoWard A robust and rapidly-deployable Red Team proxy with strong OPSEC considerations. Description Generally, Red Teams and adversary's redirect thei

Nov 9, 2022
A research implementation of team rocket's leaderless consensus protocol

rocket A research implementation of team rocket's leaderless consensus protocol backlog Run consensus tests with agents that have corrupted configurat

Feb 1, 2022
🙌It 👐just 👌not ☝works
🙌It 👐just 👌not ☝works

fuck-signal-tls-proxy Why Deliver something [3] not work at all is more rude than dirty word. In short, everything is designed to blend into the backg

May 29, 2021
A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.
A LoRaWAN nodes' and network simulator that works with a real LoRaWAN environment (such as Chirpstack) and equipped with a web interface for real-time interaction.

LWN Simulator A LoRaWAN nodes' simulator to simulate a LoRaWAN Network. Table of Contents General Info Requirements Installation General Info LWN Simu

Nov 20, 2022
Fork of Go stdlib's net/http that works with alternative TLS libraries like refraction-networking/utls.

github.com/ooni/oohttp This repository contains a fork of Go's standard library net/http package including patches to allow using this HTTP code with

Sep 29, 2022
Create a dynamic fou tunnels works behind NAT

Dynamic Linux Tunneling This software creates Gretap Tunnels over FOU for Dynamic client endpoints. It also works behind NAT444 (CGN-LSN). You can use

Oct 17, 2022
JPRQ Customizer is a customizer that helps to use the JPRQ server code and make it compatible with your own server with custom subdomain and domain
JPRQ Customizer is a customizer that helps to use the JPRQ server code and make it compatible with your own server with custom subdomain and domain

JPRQ Customizer is a customizer that helps to use the JPRQ server code and make it compatible with your own server with custom subdomain and domain.You can upload the generated directory to your web server and expose user localhost to public internet. You can use this to make your local machine a command center for your ethical hacking purpose ;)

Jan 19, 2022
A client software for acme-dns with emphasis on usability and guidance through setup and additional security safeguard mechanisms

acme-dns-client A client software for acme-dns with emphasis on usability and guidance through setup and additional security safeguard mechanisms. It

Dec 2, 2022
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.
Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution.

Connecting the Next Billion People Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core

Dec 31, 2022
Sep 23, 2022