Difference between revisions of "Workflow"
(Adding a short amount of Bitbucket stuff) |
|||
(33 intermediate revisions by 7 users not shown) | |||
Line 7: | Line 7: | ||
=== Running Commands === | === Running Commands === | ||
− | ''Mac OS X:'' You will be running commands on your local machine using '''Terminal''', which you can find in your Applications -> Utilities folder. You will be connecting to your server via SSH | + | ''Mac OS X:'' You will be running commands on your local machine using '''Terminal''', which you can find in your Applications -> Utilities folder. You will be connecting to your server via SSH. |
− | ''Windows:'' You will be running commands on your local machine using '''Cygwin''', which you will install in the next section. You will be connecting to your server via SSH | + | ''Windows:'' You will be running commands on your local machine using '''WSL''' or '''Cygwin''', which you will install in the next section. You will be connecting to your server via SSH. |
=== Version Control === | === Version Control === | ||
− | You will be using ''' | + | You will be using '''Git''' as your version control system. Git enables you to keep track of changes to your source code. If you're using VS Code, the Git integration makes is very user friendly. |
=== Text Editing === | === Text Editing === | ||
− | + | Although we highly recommend '''VS Code''', you may use '''Sublime Text''', '''Komodo Edit''', '''Notepad++''' (for Windows), and '''TextWrangler''' (for Mac). You can also use an IDE, like '''PHPStorm''', if you prefer. | |
=== File Transfer === | === File Transfer === | ||
− | + | In order to deploy your projects to your EC2 instance, you need some sort of method to transfer files from your local machine to your instance using SFTP. One option is using '''FileZilla''', an FTP client, to transport files from your local computer to your server. | |
=== Flowchart === | === Flowchart === | ||
Line 33: | Line 33: | ||
In the flowchart, your ''Git Client'' is SourceTree and your ''Text Editor'' is Komodo. The ''SFTP Client'' could be FileZilla. | In the flowchart, your ''Git Client'' is SourceTree and your ''Text Editor'' is Komodo. The ''SFTP Client'' could be FileZilla. | ||
− | == | + | == Installing a Terminal Emulator == |
+ | {{RequiredInstructions|content= | ||
+ | |||
+ | Windows is based on a fundamentally different architecture than Linux, meaning that, if you want to run Linux programs on Windows, you'll have to enable or install a special terminal emulator for it. Mac users do not need to install a terminal emulator since MacOs itself is a derivative of Unix, which is an ancestor of Linux. The Terminal utility is all you need. | ||
+ | |||
+ | === Windows Subsystem for Linux === | ||
+ | |||
+ | Starting in Windows 10, Windows has the ability to emulate Linux, meaning that you can run Linux commands on Windows, without having to install Cygwin. To enable WSL, follow [https://msdn.microsoft.com/en-us/commandline/wsl/install_guide these instructions]. Once those instructions are complete, you can open a shell by clicking on the Start menu, typing "Bash", then clicking on the entry labeled "Bash on Ubuntu on Windows". | ||
− | + | === Cygwin === | |
'''Cygwin''' is a Linux Terminal emulator for Windows. | '''Cygwin''' is a Linux Terminal emulator for Windows. | ||
− | + | ==== Installation ==== | |
− | |||
− | === Installation === | ||
The CEC lab machines already have Cygwin installed. Follow these instructions to get Cygwin up and running on your personal PC. | The CEC lab machines already have Cygwin installed. Follow these instructions to get Cygwin up and running on your personal PC. | ||
Line 50: | Line 55: | ||
#* Net -> openssh | #* Net -> openssh | ||
#* Net -> openssl | #* Net -> openssl | ||
− | #* Python -> | + | #* Python -> python3 (you will need this for Module 4) |
+ | #* Devel -> git (version control system) | ||
#* One or more of the following: | #* One or more of the following: | ||
#** Editors -> vim | #** Editors -> vim | ||
Line 57: | Line 63: | ||
# Allow the installation to complete. | # Allow the installation to complete. | ||
− | Throughout the rest of this course, when we say to "open a terminal", if you are on Windows, we mean to "open Cygwin" | + | Throughout the rest of this course, when we say to "open a terminal", if you are on Windows, we mean to "open WSL/Cygwin". |
− | |||
− | |||
}} | }} | ||
− | == | + | == Github == |
− | + | {{RequiredInstructions|content= | |
− | + | '''Github''' is a service that enables you to store your code for free in the cloud. | |
− | === Creating a | + | === Creating a Github Account === |
− | Go to [https:// | + | Go to [https://github.org/ Github.org] to create an account. |
− | ''' | + | '''Important:''' Use your @wustl.edu e-mail address to create your account. This will put your account on the "educational plan", which removes some limitations of the free account. |
− | |||
− | === Adding Your Key to | + | === Adding Your Key to Github === |
+ | '''Not uploading your key is perfectly fine, and in many cases easier. Here are the instructions though, if you'd like''' | ||
# First make sure that you've finished the [[SSH]] guide configuration instructions. | # First make sure that you've finished the [[SSH]] guide configuration instructions. | ||
− | #: We will use the same key for connecting to your remote server as for connecting to | + | #: We will use the same key for connecting to your remote server as for connecting to Github. (This is completely valid practice.) |
− | # Go to the "SSH keys" section of the settings panel. | + | # Go to the "SSH keys" section of the settings panel (Manage Account -> SSH Keys) |
+ | # Add a new key. | ||
+ | #* I recommend naming it after the computer you're using; if you're in the CEC, for example, you could name it "Warehouse Cygwin". | ||
+ | #* The contents of your key is the contents of your ''id_rsa.pub''. It looks like <code>ssh-rsa AAAAB3blahblahblahblah yourname@somedomain</code>. It is exactly the same thing that you had to paste into the ''authorized_keys'' file on your EC2 instance. | ||
− | You will now be able to push code to your | + | You will now be able to push code to your Github repository using your personal SSH key. |
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== FileZilla == | == FileZilla == | ||
Line 234: | Line 102: | ||
# Download and install FileZilla from http://filezilla-project.org/download.php?type=client | # Download and install FileZilla from http://filezilla-project.org/download.php?type=client | ||
#: If you are using a lab computer, you can save it to your H drive. | #: If you are using a lab computer, you can save it to your H drive. | ||
− | # When you launch FileZilla, go to Edit→Settings or FileZilla→Preferences, and go to the SFTP options (under Connection). Click "Add keyfile…" | + | # When you launch FileZilla, go to Edit→Settings or FileZilla→Preferences, and go to the SFTP options (under Connection). Click "Add keyfile…". |
+ | #* Choose your ''id_rsa'' file. '''OS X Tip:''' Press Shift+Command+Period to reveal hidden files in the file chooser window. | ||
+ | #* FileZilla will want to make a *.ppk file. A good place to save it would be the .ssh directory as ''id_rsa.ppk''. | ||
#: When finished, press '''OK''' (not the red ×) to save your changes. | #: When finished, press '''OK''' (not the red ×) to save your changes. | ||
# Back on the main FileZilla screen, there are four fields: Host, Username, Password, and Port. Fill them in as follows: | # Back on the main FileZilla screen, there are four fields: Host, Username, Password, and Port. Fill them in as follows: | ||
− | #* '''Hostname:''' sftp://ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/ | + | #* '''Hostname:''' sftp://<ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/> |
#* '''Username:''' The username you created on your server. | #* '''Username:''' The username you created on your server. | ||
#* '''Password:''' Since you are using a key, you may leave this blank. | #* '''Password:''' Since you are using a key, you may leave this blank. | ||
Line 249: | Line 119: | ||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 18:25, 13 September 2024
The few minutes it takes to optimize your workflow will be the best few minutes you will spend in CSE 330 and your career. It is remarkable how many hours you can save just by using the best interface for text editing and deployment.
Contents
Overview
There are going to be several aspects to our workflow in CSE 330, and we will be switching between multiple different programs. Here is how they all fit together.
Running Commands
Mac OS X: You will be running commands on your local machine using Terminal, which you can find in your Applications -> Utilities folder. You will be connecting to your server via SSH.
Windows: You will be running commands on your local machine using WSL or Cygwin, which you will install in the next section. You will be connecting to your server via SSH.
Version Control
You will be using Git as your version control system. Git enables you to keep track of changes to your source code. If you're using VS Code, the Git integration makes is very user friendly.
Text Editing
Although we highly recommend VS Code, you may use Sublime Text, Komodo Edit, Notepad++ (for Windows), and TextWrangler (for Mac). You can also use an IDE, like PHPStorm, if you prefer.
File Transfer
In order to deploy your projects to your EC2 instance, you need some sort of method to transfer files from your local machine to your instance using SFTP. One option is using FileZilla, an FTP client, to transport files from your local computer to your server.
Flowchart
If you are more visual, this flowchart might help:
The flowchart illustrates 3 methods to copy files to your cloud instance: via your text editor, via an external SFTP client, and by cloning your remote Git repository. We will be primarily using Option 2 in CSE 330 this semester.
In the flowchart, your Git Client is SourceTree and your Text Editor is Komodo. The SFTP Client could be FileZilla.
Installing a Terminal Emulator
Windows is based on a fundamentally different architecture than Linux, meaning that, if you want to run Linux programs on Windows, you'll have to enable or install a special terminal emulator for it. Mac users do not need to install a terminal emulator since MacOs itself is a derivative of Unix, which is an ancestor of Linux. The Terminal utility is all you need.
Windows Subsystem for Linux
Starting in Windows 10, Windows has the ability to emulate Linux, meaning that you can run Linux commands on Windows, without having to install Cygwin. To enable WSL, follow these instructions. Once those instructions are complete, you can open a shell by clicking on the Start menu, typing "Bash", then clicking on the entry labeled "Bash on Ubuntu on Windows".
Cygwin
Cygwin is a Linux Terminal emulator for Windows.
Installation
The CEC lab machines already have Cygwin installed. Follow these instructions to get Cygwin up and running on your personal PC.
- Run setup.exe from http://www.cygwin.com/
- Keep the Cygwin directory as the default, C:\cygwin. Choose a place like C:\cygwin\downloads to download the installation files. Choose any download site, although probably one with a .com suffix is best when you're in the US.
- In the "Select Packages" screen, select the following packages:
- Net -> openssh
- Net -> openssl
- Python -> python3 (you will need this for Module 4)
- Devel -> git (version control system)
- One or more of the following:
- Editors -> vim
- Editors -> emacs
- Editors -> nano
- Allow the installation to complete.
Throughout the rest of this course, when we say to "open a terminal", if you are on Windows, we mean to "open WSL/Cygwin".
Github
Github is a service that enables you to store your code for free in the cloud.
Creating a Github Account
Go to Github.org to create an account.
Important: Use your @wustl.edu e-mail address to create your account. This will put your account on the "educational plan", which removes some limitations of the free account.
Adding Your Key to Github
Not uploading your key is perfectly fine, and in many cases easier. Here are the instructions though, if you'd like
- First make sure that you've finished the SSH guide configuration instructions.
- We will use the same key for connecting to your remote server as for connecting to Github. (This is completely valid practice.)
- Go to the "SSH keys" section of the settings panel (Manage Account -> SSH Keys)
- Add a new key.
- I recommend naming it after the computer you're using; if you're in the CEC, for example, you could name it "Warehouse Cygwin".
- The contents of your key is the contents of your id_rsa.pub. It looks like
ssh-rsa AAAAB3blahblahblahblah yourname@somedomain
. It is exactly the same thing that you had to paste into the authorized_keys file on your EC2 instance.
You will now be able to push code to your Github repository using your personal SSH key.
FileZilla
You can use SFTP from the command line, or you can use any GUI file transfer client. All FTP clients I have seen also support SFTP. One popular FTP client is Filezilla.
- Download and install FileZilla from http://filezilla-project.org/download.php?type=client
- If you are using a lab computer, you can save it to your H drive.
- When you launch FileZilla, go to Edit→Settings or FileZilla→Preferences, and go to the SFTP options (under Connection). Click "Add keyfile…".
- Choose your id_rsa file. OS X Tip: Press Shift+Command+Period to reveal hidden files in the file chooser window.
- FileZilla will want to make a *.ppk file. A good place to save it would be the .ssh directory as id_rsa.ppk.
- When finished, press OK (not the red ×) to save your changes.
- Back on the main FileZilla screen, there are four fields: Host, Username, Password, and Port. Fill them in as follows:
- Hostname: sftp://<ec2-xxx-xx-xx-xxx.compute-1.amazonaws.com/>
- Username: The username you created on your server.
- Password: Since you are using a key, you may leave this blank.
- If you changed your SSH settings to allow password-based authentication, then you could put your password in here.
- Port: 22
- Then click Quickconnect. If everything is configured correctly, FileZilla should log into your server.
On the left and right of the FileZilla window, you can drag files between your computer and your server. Thus, you can edit a file in a text editor like Notepad++ on your decktop, and then upload it to your server by simply dragging it from the left pane to the right pane in FileZilla.