|
1 | | -# Getting started with the Nubis Project |
2 | | - |
3 | | -Welcome to the Nubis Project. We hope you will find that it meets your |
4 | | -requirements and is easy to use. In this document I will introduce you to the |
5 | | -Nubis Project and give you a number of links to other documents that will help |
6 | | -you along. |
7 | | - |
8 | | -The Nubis Project is in essence a framework for deploying applications to the |
9 | | -cloud. At this time we support only Amazon Web Services (AWS). For an overview |
10 | | -of our design principles I recommend you read our [manifesto](https://github.com/Nubisproject/nubis-docs/blob/master/MANIFESTO.md). |
11 | | - |
12 | | -## Familiarize yourself with the Nubis Project |
13 | | - |
14 | | -Now, to get you up to speed with everything you will need to know to use the |
15 | | -Nubis Project, I will provide for you a reading list. Not to worry, while this |
16 | | -list looks long, most of the documents are quite short. |
17 | | - |
18 | | -* [Nubis Overview](https://github.com/Nubisproject/nubis-docs/blob/master/SYSTEM_OVERVIEW.md) |
19 | | - will give you an outline of the pieces of the project. |
20 | | -* [Git & GitHub](https://github.com/Nubisproject/nubis-docs/blob/master/GIT_GITHUB.md) |
21 | | - provides some advice specific to Nubis. |
22 | | -* [CloudFormation](https://github.com/Nubisproject/nubis-docs/blob/master/CLOUDFORMATION.md) |
23 | | - walks through some recomendations on structure and workflow. |
24 | | -* [Prerequisites](https://github.com/Nubisproject/nubis-docs/blob/master/PREREQUISITES.md) |
25 | | - will get you set up with all the necessary tools. |
26 | | -* [Project Onbording](https://github.com/Nubisproject/nubis-docs/blob/master/PROJECT_ONBOARDING.md) |
27 | | - will guide you through onboarding your first application. |
28 | | - |
29 | | -## Deployment |
30 | | - |
31 | | -Now that you are familiar with the project and the process, it is time to get |
32 | | -coding. The first step is to assemble your deployment repository. Then it will |
33 | | -be time to deploy into the sandbox. |
34 | | - |
35 | | -As we have seen in various examples throughout these documents, you will need to |
36 | | -create a deployment repository. Take a look at the [System Overview](link) |
37 | | -document for details. |
38 | | - |
39 | | -Once your repository is all set up the next step it to deploy into the sandbox. |
40 | | -You can deploy following the procedures outlined in the [Project Onbording](https://github.com/Nubisproject/nubis-docs/blob/master/PROJECT_ONBOARDING.md#application-build-out) |
41 | | -doc. Some example commands can be found in our trusty [nubis-mediawiki](https://github.com/Nubisproject/nubis-mediawiki/blob/master/nubis/cloudformation/README.md) |
42 | | -repository. |
43 | | - |
44 | | -## Bugs, Contributions and more |
45 | | - |
46 | | -We are super excited to have you here! If you have stumbled into an issue there |
47 | | -are several ways to address it. |
48 | | - |
49 | | -First, you can fix the issue yourself and file a pull request. You will find a |
50 | | -guide in our [Contributing Doc](https://github.com/Nubisproject/nubis-docs/blob/master/CONTRIBUTING.md). |
51 | | - |
52 | | -Next, you can file an issue. Simply navigate to the Nubis Project space on |
53 | | -Github [here](https://github.com/Nubisproject), select the appropriate |
54 | | -repository and click on the issues link. For example, to file an issue against |
55 | | -nubis-stacks you would go [here](https://github.com/Nubisproject/nubis-stacks/issues) |
56 | | - |
57 | | -Finally if you are looking for a new feature to be supported, simply follow the |
58 | | -[Feature Requests](https://github.com/Nubisproject/nubis-docs/blob/master/FEATURE_REQUESTS.md) |
59 | | -guide. |
60 | | - |
61 | | ---- |
62 | | - |
63 | | -## TODO |
64 | | - |
65 | | -Document these things |
66 | | - |
67 | | -* set up git repo |
68 | | - * add nubis directory |
69 | | -* link to structure doc |
70 | | - * discuss packer and nubis-builder |
71 | | - * discuss packers use of puppet |
72 | | -* describe cloudformation template system |
73 | | - * link to cloudformation layout doc? |
74 | | -* discuss what is and is not appropritae to place in the bin directory |
75 | | -* walk through deployment of application |
76 | | -* need to link to set up for Nubis doc (set up aws, git, github, etc...) |
| 1 | +# Getting Started |
| 2 | + |
| 3 | +Before you can contribute to the Nubis project, you'll need to have a few |
| 4 | +tools installed and configured. |
| 5 | + |
| 6 | +## GitHub Account |
| 7 | + |
| 8 | +Nubis is entirely hosted on github, and we derive most of our work-flows from |
| 9 | +GitHub's recommended practices. |
| 10 | + |
| 11 | +If you are new to git or GitHub, you are probably better off familiarizing |
| 12 | +yourself with that first. There are a lot of handy tutorials straight from the |
| 13 | +source [here](https://www.atlassian.com/git/tutorials/) |
| 14 | + |
| 15 | +You will need to set up an account on GitHub. It doesn't have to be anything |
| 16 | +special, any old account will do. To set up a GitHub account, click [here](https://github.com/join). |
| 17 | + |
| 18 | +You will also want to set up your ssh keys with GitHub. You can do that [here](https://github.com/settings/ssh). |
| 19 | + |
| 20 | +## git |
| 21 | + |
| 22 | +As all of our code is on GitHub, you will need a git client of some kind. Most |
| 23 | +distributions include a git client that you can install with your package |
| 24 | +manager. You can also get git directly from their [downloads site](https://git-scm.com/downloads). |
| 25 | + |
| 26 | +For apt users: |
| 27 | + |
| 28 | +```bash |
| 29 | + |
| 30 | +aptitude install git |
| 31 | + |
| 32 | +``` |
| 33 | + |
| 34 | +Homebrew users: |
| 35 | + |
| 36 | +```bash |
| 37 | + |
| 38 | +brew install git |
| 39 | + |
| 40 | +``` |
| 41 | + |
| 42 | +## AWS Credentials |
| 43 | + |
| 44 | +In order to work with AWS you will need to set up your credentials. All access |
| 45 | +to AWS requires utilizing multi-factor authentication (MFA). When your user is |
| 46 | +added to an account you will receive an encrypted email containing a key pair. |
| 47 | + |
| 48 | +**NOTE:** These keys need to remain secret. You need to take the utmost care; |
| 49 | +**DO NOT** check them into git, send them via unencrypted email, copy them into |
| 50 | +a pastebin, etcetera. |
| 51 | + |
| 52 | +### aws-vault |
| 53 | + |
| 54 | +[aws-vault](https://github.com/99designs/aws-vault) is a tool to securely manage |
| 55 | +AWS API credentials. You will need to download this tool and place it on your |
| 56 | +path. |
| 57 | + |
| 58 | +Once installed you will use the aws-vault tool to authenticate for all access |
| 59 | +and actions within AWS. |
| 60 | + |
| 61 | +Lets start by making sure aws-vault is installed and working correctly: |
| 62 | + |
| 63 | +```bash |
| 64 | + |
| 65 | +aws-vault --version |
| 66 | + |
| 67 | +``` |
| 68 | + |
| 69 | +This should return something like `v3.7.1`. |
| 70 | + |
| 71 | +## nubis-ctl |
| 72 | + |
| 73 | +This is the tool that you will use anytime you need to interact with AWS |
| 74 | +directly. It handles everything from AMI builds to Terraform deployments. In |
| 75 | +fact, we in Nubis land use this tool for account deployments as well. This tool |
| 76 | +primarily executes Docker containers, which basically wrap other tools and their |
| 77 | +dependencies. Enough chit-chat, lets keep going. |
| 78 | + |
| 79 | +### Install docker |
| 80 | + |
| 81 | +As nubis-ctl leverages Docker containers, the first thing you will need to do is |
| 82 | +Install Docker (obvious, I know :). |
| 83 | + |
| 84 | +#### Linux |
| 85 | + |
| 86 | +**NOTE:** These packages are not required, but Docker will have reduced |
| 87 | +performance if they are not installed. |
| 88 | + |
| 89 | +```bash |
| 90 | + |
| 91 | +sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual |
| 92 | + |
| 93 | +``` |
| 94 | + |
| 95 | +Install docker (this step is required): |
| 96 | + |
| 97 | +```bash |
| 98 | + |
| 99 | +sudo apt install docker.io |
| 100 | + |
| 101 | +``` |
| 102 | + |
| 103 | +This section can be skipped, however you will need to prepend 'sudo' to all of |
| 104 | +your docker commands if you do. |
| 105 | + |
| 106 | +```bash |
| 107 | + |
| 108 | +sudo groupadd docker |
| 109 | +sudo usermod -aG docker $USER |
| 110 | + |
| 111 | +``` |
| 112 | + |
| 113 | +Log out & back in to pick up your new group membership. |
| 114 | + |
| 115 | +#### Mac |
| 116 | + |
| 117 | +[Get it here](https://store.docker.com/editions/community/docker-ce-desktop-mac) |
| 118 | + |
| 119 | +### Test that Docker is set up and running correctly |
| 120 | + |
| 121 | +Try running the hello-world docker image. This will download and run the docker |
| 122 | +image hello-world: |
| 123 | + |
| 124 | +```bash |
| 125 | + |
| 126 | +docker run hello-world |
| 127 | + |
| 128 | +``` |
| 129 | + |
| 130 | +### Set up the account credentials |
| 131 | + |
| 132 | +Using the AWS account credentials we talked about earlier, go ahead and set them |
| 133 | +up in aws-vault using the nubis-ctl tool. It will prompt you for all necessary |
| 134 | +input: |
| 135 | + |
| 136 | +```bash |
| 137 | + |
| 138 | +nubis-ctl add-account |
| 139 | + |
| 140 | +`` |
| 141 | + |
| 142 | +### Build an AMI |
| 143 | + |
| 144 | +Before we can build an AMI you will need some code to work with. Lets clone the |
| 145 | +nubis-skel repository: |
| 146 | + |
| 147 | +```bash |
| 148 | +
|
| 149 | +git clone https://github.com/nubisproject/nubis-skel.git |
| 150 | +cd nubis-skel |
| 151 | +
|
| 152 | +``` |
| 153 | + |
| 154 | +Before we build you will need to edit the `project.json` file and change |
| 155 | +`project_name` to something unique: |
| 156 | + |
| 157 | +```bash |
| 158 | +
|
| 159 | +vim nubis/builder/project.json |
| 160 | +
|
| 161 | +``` |
| 162 | + |
| 163 | +Go ahead and build the AMI. This will output an AMI ID that we will need in the |
| 164 | +deploy section below: |
| 165 | + |
| 166 | +```bash |
| 167 | +
|
| 168 | +nubis-ctl build |
| 169 | +
|
| 170 | +``` |
| 171 | + |
| 172 | +### Deploy the project |
| 173 | + |
| 174 | +Create a terraform.tfvars from the terraform.tfvars-dist and edit the variables. |
| 175 | +Be sure to replace all of the `<variables>` whith appropriate ones for your |
| 176 | +application: |
| 177 | + |
| 178 | +```bash |
| 179 | +
|
| 180 | +cp nubis/terraform/terraform.tfvars-dist nubis/terraform/terraform.tfvars |
| 181 | +vim nubis/terraform/terraform.tfvars |
| 182 | +
|
| 183 | +``` |
| 184 | + |
| 185 | +- account = "nubis-training" |
| 186 | +- region = "us-west-2" |
| 187 | +- environment = "stage" |
| 188 | +- service_name = "`<username>`-skel" |
| 189 | +- ssh_key_name = "`<username>`-key" |
| 190 | +- ssh_key_file = "`<path to your ssh key>`~/.ssh/id_rsa.pub" |
| 191 | +- nubis_sudo_groups = "`<value provided by Nubis team>`" |
| 192 | +- nubis_user_groups = "`<value provided by Nubis team>`" |
| 193 | + |
| 194 | +NB: The service_name and ssh_key_name **must** be unique in the AWS account. |
| 195 | + |
| 196 | +You are finally ready to deploy nubis-skel into the AWS account. Start by |
| 197 | +running a plan to make sure the app will deploy without errors. Then apply the |
| 198 | +plan, this will deploy the nubis-skel application into the AWS account. |
| 199 | + |
| 200 | +```bash |
| 201 | +
|
| 202 | +nubis-ctl deploy plan |
| 203 | +nubis-ctl deploy apply |
| 204 | +
|
| 205 | +``` |
| 206 | + |
| 207 | +Test your deployment by navigating to the ELB endpoint that is in the outputs |
| 208 | +section. It should look something like this: |
| 209 | + |
| 210 | + ```bash |
| 211 | +
|
| 212 | + Outputs: |
| 213 | +
|
| 214 | + address = https://www.<app-name>.stage.<region>.<account-name>.nubis.allizom.org/ |
| 215 | + Outputs: |
| 216 | +
|
| 217 | + ``` |
| 218 | + |
| 219 | +To finish up, remove your application from the training account. This saves us |
| 220 | +quite a bundle of cash: |
| 221 | + |
| 222 | +```bash |
| 223 | +
|
| 224 | +nubis-ctl deploy destroy |
| 225 | +
|
| 226 | +``` |
| 227 | + |
| 228 | +## Fin |
| 229 | + |
| 230 | +That should be all you need to get started. If you run into any issue or have |
| 231 | +any trouble, please reach out to us. We are happy to help and are quite |
| 232 | +interested in improving the project in any way we can. We are on Mozilla Slack |
| 233 | +in #nubis-users or you can reach us on the mailing list at |
| 234 | +nubis-users[at]googlegroups.com |
0 commit comments