fabric2 - Run Command Line on Remote Server via SSH¶
Fabric2 is a Python Tool can boost your Development on Remote server 10 X easier
What makes development on Remote Server difficult?¶
Edit long command in shell is hard.
Scripting in shell is hard, even though you are VIM master.
manage/upload/download artifacts interrupts your creativity, and hard to type commands.
MOST IMPORTANT: make your work repeatable and sync with your Git is HARD.
What is Fabric?¶
Fabric is a DevOps tool allow you to run shell commands, scripting, copy files via SSH.
Even better, it allows you to open a tunnel connect to jump host, and use your local computer like jump host. BUT, with your favorite GUI, text editor, shell which is not available on the jump host.
# -*- coding: utf-8 -*-
from fabric2 import Connection
with Connection(
"ec2-111-111-111-111.compute-1.amazonaws.com",
user="ec2-user",
connect_kwargs=dict(
key_filename=[
Path(HOME, "my-ec2-pem", "eq-sanhe-dev.pem").abspath,
]
)
) as conn:
conn.run('yum -y install git')
# and do more ...
Setup your Development Environment¶
TODO