@turnkeyid/deploys3
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.9 • Public • Published

    Welcome to DeployS3 👋

    License: CC BY 4.0

    Deploy your static website with single command!

    Install

    npm install -D @turnkeyid/deploys3 
    #or
    yarn add -D @turnkeyid/deploys3

    Usage

    1. First you should define configuration file, example:
    $ nano deployer.json
    {
      "configs":[
       {
           "appId": "YOUR_ID",
           "deployer": {
              "accessKey": "ABCABACS", # see How to get AWS Key bellow
              "secretKey": "ABCDEFG",
              "staticWeb": "true", # to make your bucket as static hosting
              "indexPath": "index.html", # your html root file
              "errorPath": "index.html", # your error html, use "index.html" if you are using REACT
              "source": "/path/to/build", # your source file(s)
              "uploadFolder": "", # where you want to put your files in S3
              "region": "ap-southeast-1",
              "bucket": "domain.com", # target bucket, if not exist it will create new one
              "concurentUploadLimit": 3 # limit upload at the same time, default 3
           },
           "autoGenerateCertificate": "false",
           "cloudfront": {
              "accessKey": "ABCABACS",
              "secretKey": "ABCDEFG",
              "s3BucketName": "domain.com", # your s3 bucket name
              "s3Region": "ap-southeast-1", # your s3 region
              "region": "us-east-1", # your cloudfront, default us-east-1(global)
              "cnames": "domain.com", # your domain name
              "id": "AXZXX", # if cloudfront already exist, put the id here to update, instead of creating new one
              "https": {
                 "enabled": "true", # if you want SSL
                 "ACMCertArn": "", # Aws Certificate Manager ARN
              },
              "rootDocument": "index.html", # the root document of s3
              "errorDocument": "index.html", # the error root document of s3, if not defined will use rootDocument instead
              "errorResponses": [
               {
                 "ErrorCachingMinTTL": 10, # Error cache minimum time to live
                 "ErrorCode": 302, # Source error code
                 "ResponseCode": "302", # Target error code
                 "ResponsePagePath": "redirect.html" # Error path for handling this errors
               }
              ],
           }
        },
        {...} # repeat the format for the rest configs
      ]
    }

    Another trick if you want your configs more simpler for more apps:

    $ nano deployer.json
    {
      "configs":[
         # make default value for reference
        {
          "appId": "DEFAULT", # the value should be "DEFAULT"
          "deployer": {
            # the same config as above
          }
        },
        # make specific config
        {
          "appId": "YOUR_ID",
          "deployer": {
            "bucket": "MY_BUCKET",
            "staticWeb": "false",
            "concurentUploadLimit": 5
          }
        },
        {...} # repeat the format for the rest configs
      ]
    }
    1. Skip this step if your config path is already on <root_project>/deployer.json . Set DEPLOYER_CONF_PATH=CUSTOM_CONFIG_PATH.json environtment to your command, or on your .env file, add this line:
    DEPLOYER_CONF_PATH = CUSTOM_CONFIG_PATH.json
    1. Check your configs, run $ npx deploys3 -c, it should show you your config file content.
    2. Run :
    $ npx deploys3 -d # Deploy all apps
    # 
    $ npx deploys3 -do YOUR_ID # Deploy specific config by ID
    #
    $ npx deploys3 -p my-deployer.json -do YOUR_ID # Deploy specific config by ID with specific deployer.json
    #

    Change npx to yarn if you are using yarn

    See all the commands:

    npx deploys3 -h

    Key Features

    Current:

    • Sync folder to S3
    • Set S3 bucket as static web
    • Create or Update Cloudfront Distribution, then link it to S3 bucket
    • Set Cloudfront HTTPS with given ACM (AWS Certificate Manager) ARN
    • Create Invalidation

    Future Dev:

    • Generate AWS Certificate then link it to cloudfront
    • Validate AWS Certificate with Route53 CNames
    • Route Cloudfront to Route53

    How to Get AWS Access Key and Secret Key

    official doc : https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html

    Author

    👤 TurnkeyID Developers - FatihAziz

    Show your support

    Give a ⭐️ if this project helped you! Currently the repo still in private. We will open in soon! Send issues or just messages to my email fatih@turnkey.id


    This README was generated with ❤️ by readme-md-generator

    Keywords

    Install

    npm i @turnkeyid/deploys3

    DownloadsWeekly Downloads

    111

    Version

    1.0.9

    License

    ISC

    Unpacked Size

    140 kB

    Total Files

    119

    Last publish

    Collaborators

    • gigihiski
    • fatihaziz