[DOCKER] [wip] Server-side development comfortably and freely with the server
      
      
        
        
        
        
Overview
Trouble
- Engineer Mac (MacBook Pro: i7, Mem16GB) is blowing fire and it's painful
 
- Started to eat up heavy-duty software CPUs such as online conference software (zoom) and online whiteboard (miro).
 
- On Mac of server-side engineer (Rails / AWS), various development servers are run by docker,
Slow enough to make you laugh, coupled with docker, which was originally heavy
 

Thing you want to do
- In order to reduce the load on the Mac, I want to send the process from my Mac to an external server (AWS EC2) as much as possible.

 
Anxiety and expectations
- There are various concerns about remotely separating the development environment that was completed locally until now.
Or there are expectations because it is remote.
 
- Can it be developed comfortably?
 
- "I hate developing with Vim by connecting with ssh? I want to use VSCode"
 
- Can it be developed safely?
 
- "There is no possibility of communication data leakage"
 
- Will it be possible to develop freely anywhere?
 
- "I want to work at a cafe or donut shop"
 
- Will it be possible to freely develop any terminal?
 
- "I don't want to take my computer with me on my trip !!!, I want to work on my iPad or smartphone !!"
 
- Is there any wasteful cost?
 
- "It is physiologically impossible to cost more than 10,000 yen in a month when you are not using it."
 
plan
Phase division
- 
It seemed difficult to do everything suddenly, so I divided it into phases as follows.
 
- 
[x] Phase1. Connect to the development environment with a PC from a predetermined base (office, home, etc.)

 
- 
[] Phase2. Connect to the development environment from any location on your PC

 
- 
[] Phase3. Connect to the development environment from any location with any (own) terminal

 
- 
[] Phase4. Cost optimization
* ?
 
This article
- This article exposes the ongoing notes "Let's do this here" and "Let's do this here".
 
Configuration design / survey memo
- Selected contents, selected intentions, simple comparison, setting contents, etc.
 
Configuration: Phase1

- Overview
 
- I was able to expel the CPU load of the development server (docker) and VS Code to EC2 from the usual development environment.
 
- Cost: About $ 20 a month
 
- Infrastructure: Mainly uses AWS (Route53, EC2, etc.)
 
- IDE: VSCode Remote Development
 
- Own domain
 
- Encrypt communication (SSH / HTTPS)
 
Remote server
- 
Prerequisite
 
- 
SSH possible-> Linux
 
- 
Can be published-> Domain connected (HTTPS)
 
- 
Welcome conditions
 
- 
There are ways to keep costs down
 
- 
Conclusion: AWS EC2

 
- 
Performance can be scaled out when needed
 
- 
However, it is necessary to stop temporarily
 
- 
spot instance keeps costs down
 
- 
vCPU: 2, Mem: 4GB (t3.medium) for about $ 15 a month
 
- 
(Instance operating cost + various costs such as storage)
 
- 
Because the person who wrote this article is used to it
 
- 
Many people use AWS for work. .. ..
 
- 
Other options
 
- 
Cloud system
 
- 
GCP, Azure, etc.
 
- 
VPS system
 
- 
Sakura's VPS etc.
 
- 
Settings
 
- 
[x] security group settings
 
- 
HTTPS: Set the IP address of a predetermined base (office, home, etc.) in "My IP"
 
- 
SSH: Set the IP address of a predetermined base (office, home, etc.) in "My IP"
 
Remote development environment
- 
Prerequisite
 
- 
You can edit and execute code
 
- 
Encrypted communication between client and server
 
- 
Welcome conditions
 
- 
Rich and active plugins
 
- 
It is better if it works only with a browser
 
- 
Conclusion: VSCode + Remote Development Plugin

 
- 
VS Code is an IDE that has become the standard for server-side development in 2020.
 
- 
Remote Development is a function that allows you to run the IDE on the Linux server that you SSHed to.
 
- 
Other options
 
- 
Web IDE system
* AWS Cloud9
 
Cryptographic communication
- Prerequisite
 
- Web access (HTTPS)
 
- Welcome conditions
 
- I don't want to write the trouble
 
- I want to keep costs down
 
- Conclusion
 
- freenom (original domain) + Route53 (DNS) + Caddy (HTTPS web server)
 
- freenom: free domain
 
- You can get a domain for free with a specific TLD
 
- Ref: Get domain with freenom
 
1 .tk Tokelau, New Zealand's territory in Australasia
2 .ml Mali
3 .ga Gabon
4 .cf Central Africa
5 .gq Equatorial Guinea
* Route53
[WIP] VPN
- Prerequisite
 
- I want to encrypt all the communication contents of the client
 
- New location: I don't want to add / remove a firewall (Security Group) every time I connect from a new IP
 
- Welcome conditions
 
- Operation / communication speed is fast
 
- Can be connected to various terminals such as smartphones and tablets
 
- Example: iPad / android / ChromeOS
 
- Survey
 
- Wireguard is good
 
- It seems that operation and communication are fast and installation is easy.
 
- 614th Build a VPN server with WireGuard
 
- Compatible with Mac / Windows / Linux / iOS / Android
* https://www.wireguard.com/install/
 
- Chrome OS seems to be able to use Android apps
* Add docs that cover using Wireguard from ChromeOS
 
[WIP] To develop at any time
- 
Prerequisite
 
- 
Run on Windows / Mac / Chrome OS / Android / iOS
 
- 
Welcome conditions
 
- 
Works only with a browser
 
- 
I'd be happy if I could develop it with Oculus Quest or other customized OS.
 
- 
investigating
 
- 
Connect "Development Environment Server" to VS Code Online as a Self-hosted environment
 
- 
Use "Visual Studio Online" in Self-hosted environment
 
- 
△: VS Code itself needs to be installed on the server
 
- 
Desktop environment (Gnome / LXDE) must be installed
 
- 
△: VS Code Online (codespaces) seems to be integrated into GitHub Codespace, so I'm not sure about the future
 
- 
Microsoft to integrate "Visual Studio Codespaecs" of Web IDE into "GitHub Codespaces"
 
- 
A web server version of third-party VS Code
 
- 
△: The plug-ins that can be used are limited.
 
- 
I can't use Visual Studio Intellicode
 
[WIP] Stop the server when it is not running
- I want to do something like heroku
 
- An SSH port forwarding connection request occurs to the "basket server"
 
- Authentication completed
 
- "Step server" starts "Development environment server"
 
- About 30 seconds?
 
- Connecting