Code Monkey home page Code Monkey logo

hello-cloud-world's Introduction

โ˜๏ธ Hello-Cloud-World, This is ๐Ÿ–ŒDoodle Chat!๐ŸŽจ

"Scribblers and Doodlers Unite!"

Doodle Chat Web App

๐Ÿ–ŒCreating and learning through the Best DevOps Practices ๐ŸŽจ

Express, docker, AWS ElasticBeanStock, GitHub Actions

inkfinite_graphite

Status CI to Docker Hub GitHub Issues GitHub Pull Requests License

๐Ÿ“ Table of Contents

Project Setup

Work in teams to build and deploy your first containerised application to the Cloud!

Goals for the week Can you, with only a specification to guide you, work as part of a team to build and deploy a containerised web app? Finally, you should be also able to understand what the following concepts are and in which ways they are helpful for applications running on the cloud: logging and telemetry

๐Ÿง About

โ€ข One member in your group, create a GitHub repo for your Hello Cloud World! project.
โ€ข Add the other members of your group as collaborators.
โ€ข Create a simple Node.js project using Express.
The idea is for you to choose what you would like to render on the page and see on the web when your application is on the cloud. Choose something that you'd like to show to your friends! โ€ข See our Trello Board for more information: Group2-Hello-Cloud-World-Week-1

๐Ÿ Getting Started

FORMULAS

Prerequisites

What things you need to install the software and how to install them.

  • Embedded below is essentially the simplest Express app you can create. It is a single file app โ€” not what youโ€™d get if you use the Express generator, which creates the scaffolding for a full app with numerous JavaScript files, Jade templates, and sub-directories for various purposes.

  • As for planning, the team agreed on creating something fun, engaging, and interactive! We were also concerned with time and the amount of DevOps concepts we'll be squeezing in this week to learn from. We decided by focusing on a simple, MVP ( Minimal Viable Product)- this would allow us enough wiggle room to assess and process our findings while researching on containers, telemetry, logging, and AWS EBS

  • Express

First, create a directory named myapp, change to it and run

npm init

Then, install express as a dependency, as per the installation guide

In the myapp directory, create a file named app.js and copy in the code from the example above.

The req (request) and res (response) are the exact same objects that Node provides, so you can invoke req.pipe(), req.on('data', callback), and anything else you would do without Express involved. Run the app with the following command:

$ node app.js

Then, load http://localhost:3000/ in a browser to see the output.

const express = require('express')
const app = express()
const path = require('path')
const port = 3000

app.use(express.static(__dirname + '/public')); // tells express to look at everything in the public folder

// renders the index.html (homepage)
app.get('/', (req, res) => {
  res.sendFile('index.html');
  //res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})

We then set up the Docker file: Please follow tutorial here, docker

Create the Dockerfile:

// tells Docker what base image we would like to use for our application.
Docker images can be inherited from other images. Therefore, instead of 
creating our own base image, weโ€™ll use the official Node.js image that 
already has all the tools and packages that we need to run a Node.js application. //
FROM node:12.18.1
ENV NODE_ENV=production
WORKDIR /Hello-Cloud-World
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production
# The COPY command takes all the files located in the current directory and copies them into the image.
COPY . .
EXPOSE 3000
CMD ["node", "app.js"]

Installing

How to get AWS Elasticbeanstalk up and running.

Getting started using Elastic Beanstalk

To help you understand how AWS Elastic Beanstalk works, this tutorial walks you through creating, exploring, updating, and deleting an Elastic Beanstalk application. It takes less than an hour to complete.

There is no cost for using Elastic Beanstalk, but the AWS resources that it creates for this tutorial are live (and don't run in a sandbox). You incur the standard usage fees for these resources until you terminate them at the end of this tutorial. The total charges are typically less than a dollar. For information about how to minimize charges, see AWS free tier.

Topics

Setting up: Create an AWS account

If you're not already an AWS customer, you need to create an AWS account. Signing up enables you to access Elastic Beanstalk and other AWS services that you need.

To sign up for an AWS account

  1. Open the Elastic Beanstalk console, and in the Regions list, select your AWS Region.

  2. Follow the instructions shown.

End with an example of getting some data out of the system or using it for a little demo.

๐Ÿ”ง Running the tests

Explain how to run the automated tests for this system.

Break down into end to end tests

Explain what these tests test and why

And coding style tests

Explain what these tests test and why

-------------------------------------------|-----------------------|
docker run -dp 3000:3000 hello-cloud-world |   Runs code           |
-------------------------------------------|-----------------------|
docker ps (lists)                          |    Lists              |
-------------------------------------------| ----------------------|     
docker ps -a                               |  (lists all commands) |
-------------------------------------------|-----------------------|

For a full list of docker commands visit:docker list of commands

Dont forget to turn off/stop the container images when running, deleting, adding or editing files.

Please find DevOps cheat sheets for the command line here:

{
    "AWSEBDockerrunVersion": "1",
    "Image": {
        "Name": "cgloker/hello-cloud-world-v3"
    },
    "Ports": [
        {
            "ContainerPort": "3000"
        }
    ]
}

๐ŸŽˆ Usage

Bootstrap 4 - 'Sketchy' Theme docker desktop MacOS dockerfile GitHub Actions - Docker and Node.Js Packages Docker+Github Actions - BuildX CSS HTML Jquery ElasticBeanstalk(AWS) IAM Account

โ›๏ธ Built Using

๐Ÿงช Testing, CI/CD & Workflows

GitHub Actions + Docker and Node.Js Packages

๐Ÿš€ Deployment

IAM ACCOUNTS - EBS [AWS]

โœ๏ธ Authors

๐ŸŽ‰ Acknowledgements

  • ๐ŸŽฉ Hat tip to anyone whose code was used!
  • Inspiration: Group 2 Week 1 Makers DevOps, Art, Creating, and Learning
  • Reference:
  • Express - Web/Server Framework
  • docker - Server Framework
  • Bootstrap - Some modals We took for Styling
  • NodeJs - Server Environment
  • DEPLOYED
  • EBS - Cloud

hello-cloud-world's People

Contributors

blank-21 avatar cgloker avatar ghostglass avatar tuyet-le avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.