Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wolox/aws-deploy-script-frontend
https://github.com/wolox/aws-deploy-script-frontend
frontend
Last synced: about 18 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/wolox/aws-deploy-script-frontend
- Owner: Wolox
- License: mit
- Created: 2018-10-08T15:37:53.000Z (about 6 years ago)
- Default Branch: development
- Last Pushed: 2023-07-08T13:09:23.000Z (over 1 year ago)
- Last Synced: 2024-04-30T01:42:51.884Z (7 months ago)
- Topics: frontend
- Language: JavaScript
- Size: 1.11 MB
- Stars: 12
- Watchers: 20
- Forks: 3
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# AWS Deploy script
[![FEArmy](https://github.com/Wolox/react-chat-widget/raw/master/assets/FEA_open_source_sm.png)](https://github.com/orgs/Wolox/teams/front-end-army/members)
AWS script for deploying your frontend applications.
## Introduction
The most common configuration used for our projects is using an S3 Bucket to contain our static files. Optionally you can have a CloudFront playing as a CDN.
The aim of this script is to read all your files and sync directly to the bucket without having to install AWS CLI or any kind of credentials configuration.
This script is cross project which means you only need to have a `build/` folder to sync.
## Folder structure
```
ROOT
build/
index.html
...
aws.js
...
```- The `aws.js` file should be at the root of your project, it will contain credentials and will export them as an object like this:
- The `aws.js` file also contains a specific object called metrics to persist the measured `deploy-time` in a db. If you do not wish to persist the metric the object can be removed.
```js
module.exports = {
development: {
accessKeyId: "XXXXXXXXXXXXXXXXXXXX",
secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
region: "us-east-1",
bucket: "",
distributionId: "XXXXXXXXXXXXXX",
options: { // Optional
preserveFiles: [/^sitemap/, "bar.js"]
}
},
stage: {
accessKeyId: "XXXXXXXXXXXXXXXXXXXX",
secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
region: "us-east-1",
bucket: "",
distributionId: "XXXXXXXXXXXXXX",
options: { // Optional
preserveFiles: ["static/baz.js"]
}
},
metrics: {
tech: "react/vue/angular",
repoName: "",
baseUrl: ""
}
};
```- The `build/` folder will contain the file you want to sync
- The `distributionId` is optional, in case you've got it. The script will create an invalidation for all your files.
## Options
- `preserveFiles`. It allows to specify an array of S3 file paths that won't be removed when the script cleans the bucket before uploading the new build. It's useful if you want to upload files manually to the S3 bucket. Supports regex and strings
- `environment` or `e`. It specifies the environment in which you are going to deploy your app. Also the key of your `aws.js` file that has the corresponding credentials
- `path` or `p`. The path of you generated static build files.
- `outputPath` or `o`. The S3 path to upload your files (e.g. in case you don't want to upload all files in the root of the bucket)
## Usage
You can install this package globally and run `aws-deploy`
```
npm install -g aws-deploy-script-fe
```The command line to execute can be:
```
aws-deploy --env --path
```
or
```
aws-deploy -e -p
```* This **enviroment-name** is the key of the main object exported in `aws.js`.
* If no **enviroment-name** is declared then it will use `development` as default.
* The **build-path** is optional and defaults to `build`.## Required dependencies
The dependency you need to install is [aws-sdk](https://www.npmjs.com/package/aws-sdk)
## Required policies
To run this script you must add these action policies to the user configured in the `aws.js` file
```js
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:DeleteObject",
"cloudfront:CreateInvalidation"
]
```## About
This project is maintained by [Damián Finkelstein](https://github.com/damfinkel), [Pablo Ferro](https://github.com/pabloferro), [Francisco Iglesias](https://github.com/FrankIglesias) and [Lucas Zibell](https://github.com/LucasZibell) and it was written by [Wolox](http://www.wolox.com.ar).
![Wolox](https://raw.githubusercontent.com/Wolox/press-kit/master/logos/logo_banner.png)