[PYTHON] code-server online environment (7) Deploy compute on git on EC2

table of contents Local environment 1st day Online environment version 1st day Improve work environment

Online environment, day 2 Create a virtual network

Online environment 3rd day Launch an EC2 instance with Boto3

Online environment 4th day Try running Code-Server in the cloud

Online environment 5th day Launch code-server on Docker

Online environment, day 6 Let's automate

Online environment 7th day Deploy compute on git on EC2

... Online version .. Built with Coompose file

Online .. Try K8S

...

Demon remodeling

Introduction

Up to the last time, you can use Docker to launch Code-Server on EC Instance.

This time, I will try from compose file to launching to EC2 Instance on github.

--Create

I don't have any new knowledge, so please try to make it. I think it's good to be dirty.

Deliverable example

https://github.com/kyorohiro/advent-2019-code-server/tree/master/app/docker_image_uploader_for_ec2

$ git clone https://github.com/kyorohiro/advent-2019-code-server.git
$ cd advent-2019-code-server/remote_cs04/
$ docker-compose build
$ docker-compose up -d

In your browser, open http://127.0.0.1:8443/.

Screen Shot 2019-12-24 at 0.39.23.png

On Terminal

Terminal


$ pip install -r requirements.txt
$ aws configure 
..
..

Create EC2Instance

$ python main.py --create

Get EC2 information

$ python main.py --get
>>>> i-0d1e7775a07bbb326
>>>> 
>>>> 3.112.18.33
>>>> ip-10-1-0-228.ap-northeast-1.compute.internal
>>>> 10.1.0.228
>>>> {'Code': 16, 'Name': 'running'}

Access with a browser

Screen Shot 2019-12-24 at 1.11.08.png Screen Shot 2019-12-24 at 1.06.50.png Screen Shot 2019-12-24 at 1.12.23.png

It's done !!

Let's pause

$ python main_command.py --stop

I'm stopping EC2 Insntace. You can keep the usage fee low. EBS Storage usage etc. will be charged.

Let's resume

 python main_command.py --start

You can resume what you stopped. Note that the IP address will change

Let's delete

#logout from ec2 instance
$ exit

#local code-On the server
$ python main.py --delete

next time

When making it based on EC2, I think that there is nothing to explain after that, just make it.

If possible so far I think it is already possible to place VSCode (Code-Server) on the cloud.

Docker Image, Composefile or whatever, regardless of VSCode You can put it on the cloud.

Next time, we will enter the K8S edition or Fargate edition. I've made it myself until now, We will use what we have to do this.

code

https://github.com/kyorohiro/advent-2019-code-server/tree/master/remote_cs06

Recommended Posts

code-server online environment (7) Deploy compute on git on EC2
code-server online environment (4) Launch code-server on the EC2 instance
code-server online environment (5) Launch code-server on Docker
code-server online environment (6) Let's automate
code-server online environment (6) Let's automate
code-server online environment (5) Launch code-server on Docker
code-server online environment (4) Launch code-server on the EC2 instance
code-server online environment (7) Deploy compute on git on EC2
code-server Online environment (2) Create a virtual network with Boto3
code-server Local environment (3) Try using VSCode Plugin
Build python environment with pyenv on EC2 (ubuntu)
Build Python3 + flask environment on GCP Compute Engine
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
code-server Online environment (2) Create a virtual network with Boto3
How to install git on Linux such as EC2