Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
926eb80
Describe terraform templates
matheus-1618 Mar 24, 2023
b2f9c11
Centralize doc in README
matheus-1618 Mar 24, 2023
894411d
Add some integrations
matheus-1618 Mar 27, 2023
9811d30
Change title
matheus-1618 Mar 28, 2023
566da56
Add integration for Amplify app
matheus-1618 Mar 29, 2023
6db27de
Merge branch 'main' of https://github.com/matheus-1618/Lusk
matheus-1618 Mar 29, 2023
a1faadc
Generalize variables in terraform
matheus-1618 Mar 29, 2023
96ade57
Enable updates in the frontend repository trough CLI
matheus-1618 Mar 29, 2023
d608c23
Enable lambda permissions over DynamoDb
matheus-1618 Mar 30, 2023
ce80988
Init dynamo lambda functions
matheus-1618 Mar 30, 2023
1e870cd
Add more functions
matheus-1618 Mar 30, 2023
2e37dd1
Enable multiple lambdas functions and update webapp
matheus-1618 Mar 30, 2023
855423d
Create Lusk class and CLI interface
matheus-1618 Mar 31, 2023
43bec06
Update README.md
matheus-1618 Mar 31, 2023
fa054b8
Refactore Lusk object
matheus-1618 Apr 1, 2023
f823f8e
Merge branch 'main' of https://github.com/matheus-1618/Lusk
matheus-1618 Apr 1, 2023
0275ca6
Change API framework of the application
matheus-1618 Apr 16, 2023
901a580
Organize folders and start GUI interface
matheus-1618 Apr 18, 2023
674ff50
Modify script for installation and add script to run app
matheus-1618 Apr 23, 2023
386c0a9
Adjust index page
matheus-1618 Apr 28, 2023
e0f8320
Start Backend API and change first UI
matheus-1618 May 1, 2023
d557216
Fix flex box
matheus-1618 May 1, 2023
3bb1e56
Update React app creation
matheus-1618 May 1, 2023
c4e66e4
Update install.sh
matheus-1618 May 1, 2023
815c0c9
harmonize UI for interface
matheus-1618 May 6, 2023
4a99f4f
Merge branch 'main' of https://github.com/matheus-1618/Lusk
matheus-1618 May 6, 2023
6546536
New interface for Win32
matheus-1618 May 6, 2023
5db9f6b
Integrate resources of interface
matheus-1618 May 6, 2023
3d6f31d
Add routes for internal API
matheus-1618 May 6, 2023
41069ee
Modify scripts
matheus-1618 May 7, 2023
ffb3937
Adjust Win32 interface
matheus-1618 May 7, 2023
c43f6b6
Update requirements.txt
matheus-1618 May 8, 2023
a14ffce
Backend API methods created
matheus-1618 May 15, 2023
961d8d9
Merge branch 'main' of https://github.com/matheus-1618/Lusk
matheus-1618 May 15, 2023
b747e5e
Create integration to deploy backend resources on AWS
matheus-1618 May 15, 2023
05f5a50
Lusk V.1.0.0
matheus-1618 May 15, 2023
0493121
Update README.md
matheus-1618 May 15, 2023
061527a
Modify documentation
matheus-1618 May 18, 2023
da4da98
Update README.md
matheus-1618 May 18, 2023
cca8034
Create README.md
matheus-1618 May 18, 2023
6b30d9e
Update install.sh
matheus-1618 May 19, 2023
83d8c5f
V1.0.1
matheus-1618 May 20, 2023
ab09789
V1.0.1
matheus-1618 May 20, 2023
84f59b0
Resize Windows style screens
matheus-1618 May 24, 2023
c9f9931
Correct bugs and paths
matheus-1618 May 25, 2023
990f27a
Change README
matheus-1618 May 25, 2023
a989fd7
Update README.md
matheus-1618 May 25, 2023
5348de3
Update install.sh
matheus-1618 May 26, 2023
9261322
Bump word-wrap from 1.2.3 to 1.2.5 in /src/frontend
dependabot[bot] Jul 24, 2023
53722fa
Bump semver from 6.3.0 to 6.3.1 in /src/frontend
dependabot[bot] Jul 24, 2023
3b7a3ed
Bump tough-cookie from 4.1.2 to 4.1.3 in /src/frontend
dependabot[bot] Jul 24, 2023
bd2c98d
Bump semver from 6.3.0 to 6.3.1 in /src/frontend
matheus-1618 Jul 24, 2023
376fe34
Bump word-wrap from 1.2.3 to 1.2.5 in /src/frontend
matheus-1618 Jul 24, 2023
692b2ee
Bump tough-cookie from 4.1.2 to 4.1.3 in /src/frontend
matheus-1618 Jul 24, 2023
8e24990
Bump @babel/traverse from 7.21.4 to 7.23.6 in /src/frontend
dependabot[bot] Dec 21, 2023
611cf23
Bump @babel/traverse from 7.21.4 to 7.23.6 in /src/frontend
matheus-1618 Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

# Local .terraform directories
**/.terraform/*

**__pycache__/
# .tfstate files
*.terraform
*.tfstate
*.tfstate.*
*.hcl

#env files
.env
# Crash log files
crash.log
crash.*.log
Expand All @@ -35,4 +39,26 @@ override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc
terraform.rc

# dependencies
**/node_modules/*
/node_modules
/.pnp
.pnp.js

# testing
/coverage
# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
152 changes: 147 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,159 @@
<div align="center" style="max-width:28rem;">
<div align="center" >


![AWS](https://img.shields.io/badge/Amazon_AWS-232F3E?style=for-the-badge&logo=amazon-aws&logoColor=white)
![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
![Terraform](https://img.shields.io/badge/Terraform-7B42BC?style=for-the-badge&logo=terraform&logoColor=white)
![React](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB)
![Django](https://img.shields.io/badge/Django-092E20?style=for-the-badge&logo=django&logoColor=white)
![FastAPI](https://img.shields.io/badge/FastAPI-005571?style=for-the-badge&logo=fastapi)


<img src='assets/Lusk.png' style="width:25rem;"/>

<img src='assets/Lusk.png'/>
## Serverless Architecture Management Interface for AWS

</div>


<div align="center" style="max-width:28rem;">

## Serverless Architecture orchestration Interface for AWS
## [Full Documentation and RoadMap available here](https://matheus-1618.github.io/Lusk-docs/)

</div>

[Full Documentation and RoadMap available here](https://matheus-1618.github.io/Lusk-docs/)
Lusk is an early-stage open source tool to assist developers in their first steps into cloud computing.


With Lusk, you don't have to manage the underlying configuration of servers, subnets and DataBases.


You just need to:

* Create your own web application (there is a React template in **webapp/** folder);

* Create your processing functions (AWS Lambdas functions) or use ready-made functions in the **lambda_functions** folder, which can integrate with *DataBases*, *process requests* and *more*, all behind managed API Endpoints.

Easy isn't?

<div align="center" >

<img align="center" style="width:500px" src='assets/cloud-computing.gif'>

</div >



## Build your own Lusk

* Do want to create your own Serverless Architecture Management Plataform?

* Understand more about Cloud and IaC concepts with a hands-on tutorial?

* Integrate another services or applications in the Lusk?

<div align="center" >

<img align="center" style="width:500px" src='assets/build.gif'>

</div >

**If you want to discover the underlying steps to build this infrastructure using Terraform or it's a curious person, follow the [Roadmap](https://matheus-1618.github.io/Lusk-docs/roadmap/), and create your own Plataform, learning and customizing as you wish .**


## Enjoy a managed Full Stack Serverless archictecture

**With Lusk deploy a Full stack app become simplier.**

<div align="center" style="max-width:38rem;">

![image](https://github.com/matheus-1618/Lusk/assets/71362534/dbfffecc-63bc-404b-bf25-300cba6678cc)
</div>

:warning: **It is desirable to have your Github credentials in the machine/system which you are executing the application. If you don't have, configure it following this [tutorial](https://www.freecodecamp.org/portuguese/news/como-resolver-o-problema-de-o-git-pedir-sempre-as-credenciais-do-usuario/)**.


### Using Graphical Interface

1. Clone the repository:
```bash
git clone https://github.com/matheus-1618/Lusk
```

2. Install dependencies (if you already have some installed, it'll be jumped):
```bash
./install.sh
```

3. Run the graphical interface:
```bash
./run.sh
```

4. Log with your [AWS credentials](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html) and [Github token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) (used internal only in a **.env** file):
<div align="center" >
<img style="width:50rem;" src='assets/login.png'>
</div>

#### Creating your first application in 5 clicks

1. Create an Dynamo DB NoSQL Database:
<div align="center" >
<img style="width:50rem;" src='assets/idynamo.png'>
</div>

2. Create two Lambda Functions behind an API Gateway endpoint's to interact with Dynamo:
<div align="center" >
<img style="width:50rem;" src='assets/iapi.png'>
</div>

Deploy **insert_in_dynamo** first, and **read_dynamo** after (you can test it):
<br>
<div align="center" >
<img style="width:50rem;" src='assets/iapi2.png'>
</div>

3. Integrate the API's endpoints in the **webapp/App.js** file to feedback the Frontend interface:
<div align="center" >
<img style="width:50rem;" src="./assets/webpage.png">
</div>

4. Create an Web Application hosted on Amplify Hosting with updates with CI/CD in your Github account:
<div align="center" >
<img style="width:50rem;" src='assets/iwebapp.png'>
</div>

5. Clean, if you wish, your infrastructure with one click:
<div align="center" >
<img style="width:50rem;" src='assets/destroy.png'>
</div>


### Using CLI Interface

If you prefer use a Command Line interface, follow the steps above:

1. Clone the repository:
```bash
git clone https://github.com/matheus-1618/Lusk
```

2. Install dependencies (if you already have some installed, it'll be jumped):
```bash
./install.sh
```

3. Run the Command Line interface:
```bash
./cli.sh
```
4. Fill out the credentials to create an **.env** file:
<div align="center" >
<img style="width:50rem;" src='assets/cli.png'>
</div>

5. Enjoy the Application!
<div align="center" >
<img style="width:50rem;"/ src='assets/cloud.gif'>
</div>


Binary file removed assets/Captura de tela de 2023-03-19 16-01-50.png
Binary file not shown.
Binary file removed assets/Captura de tela de 2023-03-19 16-03-39.png
Binary file not shown.
Binary file not shown.
Binary file added assets/build.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cloud-computing.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cloud.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/destroy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/iapi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/iapi2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/idynamo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/iwebapp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/webpage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CURRENT_DIR=$(pwd)
MED_PATH="/src/backend"
DIR_PATH="/src/backend/venv"
full_path="$CURRENT_DIR/$DIR_PATH"
if [ -d "$full_path" ]; then
echo "Starting Backend"
cd "$CURRENT_DIR/$MED_PATH"
source venv/activate/bin
python3 main.py
cd "$CURRENT_DIR"
else
echo "Dependencies not satisfied, run sudo ./install.sh"
fi
85 changes: 70 additions & 15 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,78 @@
#instalando Dependências Terraform
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
if ! command -v terraform &> /dev/null; then
echo "Installing Terraform"
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common

wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list

sudo apt update
sudo apt update

sudo apt-get install terraform
sudo apt-get install terraform
else
echo "O Terraform already installed!"
fi

#instalando Dependências Node.js
if ! command -v node &> /dev/null; then
echo "Installing Node.js above version 14"
CURRENT_DIR=$(pwd)
cd ~
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
cd "$CURRENT_DIR"
else
echo "Node.js already installed!"
fi

# Configurando depedências da automação via Python
cd python/
python3 -m virtualenv venv
#Instalando package da estrutura frontend
CURRENT_DIR=$(pwd)
DIR_PATH="/src/frontend/node_modules"
full_path="$CURRENT_DIR/$DIR_PATH"
if [ -d "$full_path" ]; then
echo "App ready to run!"
else
echo "Installing Lusk dependecies"
cd "$CURRENT_DIR/src/frontend/"
npm i --force
cd "$CURRENT_DIR"
fi

#Instalando python caso não detectado
if ! command -v python3 &> /dev/null; then
echo "Python e/ou Python 3 are not installed, installing them for you..."
sudo apt-get update
sudo apt-get install python3
pip install virtualenv
else
echo "Python or Python 3 already installed!"
fi

#Ativando ambiente virtual para instalação das dependências
CURRENT_DIR=$(pwd)
MED_PATH="src/backend"
DIR_PATH="src/backend/venv"
full_path="$CURRENT_DIR/$DIR_PATH"
if [ -d "$full_path" ]; then
echo "Virtual Enviroment already configured"
else
echo "Installing virtual environment"
cd "$CURRENT_DIR/$MED_PATH"
python3 -m virtualenv venv
pip install -r "$CURRENT_DIR"/requirements.txt
cd "$CURRENT_DIR"
echo "Enviroment ready"
fi

sudo apt-get install zip
pip install virtualenv
5 changes: 5 additions & 0 deletions lambda_functions/hello_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
def lambda_handler(event, context):
return {
'statusCode': 200,
'headers': {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS,POST,GET'
},
'body': json.dumps('Hello from Lambda!')
}
47 changes: 47 additions & 0 deletions lambda_functions/insert_in_dynamo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import boto3
import json


# Função Lambda que insere um novo item na tabela
def lambda_handler(event, context):
client = boto3.client('dynamodb')
dynamodb = boto3.resource('dynamodb')

# Obtém o corpo da requisição
print(event)
try:
body = json.loads(event['body'])
print(body)

response = client.list_tables()
table_name = response['TableNames'][0]

table = dynamodb.Table(table_name)

status = ''
# Insere o novo item na tabela
response = table.put_item(
Item={
'id': body['id'],
'name': body['name']
}
)
status = 'Item inserido com sucesso'
except:
status = 'Error. Expected json content: {"id":"<number>","name":"<name>"}'


# Retorna a resposta da operação
return {
'statusCode': 200,
'headers': {
"Content-Type" : "application/json",
"Access-Control-Allow-Headers" : "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token",
"Access-Control-Allow-Methods" : "OPTIONS,POST",
"Access-Control-Allow-Credentials" : 'true',
"Access-Control-Allow-Origin" : "*",
"X-Requested-With" : "*"
},
'body': json.dumps(status)
}

Loading