Git Product home page Git Product logo

confetti's Introduction

confetti-logo-small

usage | security | change log | appendix

(alpha) A tool to help authoring static sites with Amazon Web Services (AWS).

Rationale: Static sites are fun. Deploying to S3 is pure joy. CloudFront makes scaling something you don't think about anymore. No servers to administrate; no tears to cry. Setting it all up however is not as straightforward. Confetti is an attempt at encoding best practices into a repeatable program using CloudFormation and providing handy tools for basic as well as advanced deployment scenarios.

[confetti/confetti "0.2.1"] ;; latest release

Who is this for?

  • People that want static sites on custom domains with free SSL and minimal hassle.
  • People that want to host static sites under root domains (e.g. example.com).
  • People that want to setup new static sites often without much manual work (takes 15min of mostly waiting w/ Confetti).
  • People that want to effortlessly have multiple static sites under one domain (e.g. demo.example.com and example.com)
  • People that want excellent distribution accross the globe using a leading CDN.
  • People that want to be able to delete all resources related to a site with a single click.

Features

  • Create all AWS resources required for ideal deployment of static sites
    • S3 Bucket, Bucket Policy, Cloudfront Distribution
  • All resources are created via a CloudFormation template, allowing
    • easy deletion if something went wrong
    • abort upon conflicting configration
  • Provide a separate user & access key that can only push to the bucket
  • Setup DNS via Route 53 (optional)
  • Follow AWS best practices for deploying static sites.
  • Efficient synchronization of files to S3.

Usage

creating a site | syncing your site | final step: dns | adding subdomains

Confetti is packaged up as a boot task. This is mainly because boot makes it easy to write commandline apps in Clojure without needing to worry about bootstrapping or dependency resolution.

Confetti provides two commands, in Boot-lingo called tasks. The create-site task will create a CloudFormation stack with all resources for your static website and save all important information to an EDN file in the current directory.

Let's go through an example of creating a site and syncing it for the first time.

Creating a site

๐Ÿ’ก Confused about access keys? Check out the Security section of this README.

Let's say you want to deploy a site at my-app.com. To create an S3 bucket, a CloudFront distribution and restricted access keys you can run the following:

boot -d confetti create-site --domain "my-app.com" --access-key XXX --secret-key YYY

Note: the -d confetti bit makes sure Boot will download confetti so the create-site task will be available.

Exception! Because you want to use a naked/APEX domain you have to use Route53 for DNS. (You can find more on this in the Appendix.) Try again with DNS enabled:

boot -d confetti create-site --domain "my-app.com" --access-key XXX --secret-key YYY --dns

This should kick of the process. The first feedback should be appearing on your screen. At some point no new events will get printed but the process also hasn't returned yet. What you're waiting for now is the creation of your CloudFront distribution. This usually takes between 10-15min.

You may kill the process at this point. Everything is running remotely and won't be interrupted. A .confetti.edn file is saved in your current working directory and if using the fetch-outputs task with sufficient credentials you can download all useful information at any point in time. (The task will tell you if the stack isn't ready yet as well.)

Confetti create-site progress

After the create-site task finishes you should find a file in your current working directory: my-app-com.confetti.edn. It's contents should contain everything important about your newly provisioned resources:

{:stack-id "arn:aws:cloudformation:us-east-1:297681564547:stack/my-app-com/xxx",
 :bucket-name "my-app-com-sitebucket-3fu0w0729ndk",
 :cloudfront-id "E3760XUWU2V9R7",
 :cloudfront-url "d3up0oy7r2svli.cloudfront.net",
 :access-key "AAA",
 :secret-key "BBB",
 :website-url "http://my-app.com",
 :hosted-zone-id "Z3KJWNUJTT8GHO"}

Now everything is ready for the first deployment!

Syncing your site

Now the sync-bucket task comes into play. While the task provides many different ways to specify what to upload we will just show the simplest here: syncing a local directory. For our demo purposes lets create a directory quickly:

mkdir my-app-site
echo "Hello World" > my-app-site/index.html
echo "About Us" > my-app-site/about.html

Now lets sync it. Take the bucket-name, access-key and secret-key values from the .confetti.edn file:

boot -d confetti sync-bucket --bucket "my-app-com-sitebucket-3fu0w0729ndk" \
                             --access-key AAA --secret-key BBB --dir my-app-site
;; or alternatively
boot -d confetti sync-bucket --confetti-edn your-site.confetti.edn --dir my-app-site

This will upload index.html and about.html to your bucket. To verify that everything was successful you can navigate to the URL stored as cloudfront-url in the edn file.

There are many more ways to specify what files to upload (with custom metadata if wanted) which are not covered by this guide. Consult boot sync-bucket --help for details.

Final Step: DNS

Now the only step missing is properly setting up DNS. What needs to be done here varies depending on whether you enabled the --dns option or not. In the example above we enabled it so lets cover that case first:

DNS with Route53: Because you have a root/naked/apex domain setup you decided to use manged DNS by AWS. Now you need to set the nameservers for the domain you used to AWS' nameservers. These are different for different Hosted Zones so you need to look them up in the AWS Console.

Without Route53: When not using Route53 the only thing you have to do is to add a CNAME entry to the Zonefile of your domain that points to the Cloudfront distribution.

Both of these steps will vary from domain registrar to domain registrar so it's recommended to check their individual documentation.

๐Ÿ”’ Want SSL? Here's how to enable it.

Adding Subdomains

Let's say you used Confetti to create a site weloveparens.com and now want to add a static site to a subdomain of that domain. You can just run:

boot create-site --domain "shop.weloveparens.com" --dns --access-key FOO --secret-key BAR

This will create a Route53 RecordSet in the HostedZone which has previously been created for you when setting up weloveparens.com. The S3 bucket, CloudFront distribution and so on will be created as usual. Also as always everything (including the RecordSet) will be created as a CloudFormation stack so if you no longer need it you can just delete the stack, leaving weloveparens.com unaffected.

Getting Help

To get help on the command line you can always run:

boot create-site --help
boot fetch-outputs --help
boot sync-bucket --help

Also feel free to open issues to ask questions or suggest improvements.

Security

Giving your AWS keys to some program and just letting it run with it is kind of frightening so this section is aimed at giving some comfort around that.

  • The create-site task will create a CloudFormation stack according to a template defined in confetti-clj/cloudformation.
  • If you want to see the CloudFormation template before you run anything you can pass the --dry-run argument.
  • The credentials you pass to create-site must have permissions to create the individual resources listed in the CloudFormation template. (In the future Confetti may provide an AWS IAM policy snippet so you can create a user that has all the rights Confetti needs.)
  • The CloudFormation template will also generate an Access Key + Secret. This keypair is restricted, it can only access the S3 Bucket and invalidate CloudFront caches.
  • The keypair should be sufficient to update your static site and restricted enough that you can share it with others.

your-site.confetti.edn โš ๏ธ

As of version 0.2.0 the create-site command will create a file ending in .confetti.edn this contains all information needed to maintain your site. The information in this file contains secrets!

Update: I've come to the conclusion that creating this file is a bad idea. People will inevitably commit it and publicise the keys to their S3 bucket. In the future I would like to just print something in a format that is understood by direnv and recommend env vars / direnv instead.

Changes

0.2.1

0.2.0

  • Upgrade to [confetti/cloudformation "0.1.6"], which brings the following improvements:
    • Enable compression by default
    • Fix some misconfiguration of the origin that caused problems when enabling SSL

0.1.5

0.1.5-alpha

  • HostedZone Reuse: Creating a new HostedZone for each site has two drawbacks:

    • Each HostedZone costs 50 cent
    • Each HostedZone has a distinct set of nameservers that you'd need to supply to your domain provider

    By using one HostedZone for your root domain example.com these problems are solved and adding a new site at demo.example.com is just a matter of adding a RecordSet. Confetti now tries to find an existing HostedZone and only adds a RecordSet if it finds one.

  • New invalidation-paths option for the sync-bucket task. Previously invalidation paths were determined based on the files you uploaded. Now you can provide a custom set. (#21 + #29)

  • Fix bug with new method of supplying options via a .confetti.edn file

0.1.4

  • When users supply the confetti-edn option, we now accept both versions (ending with .confetti.edn and just the part before that). Previously it was expected that you only supply the part before the .confetti.edn suffix
  • Adapt Readme to suggest usage of confetti-edn option and fetch-outputs task
  • Refactor reporting into separate task that is called from create-site
  • Give progress-reporting a hard limit of 16min. Previously the error reporting often got stuck preventing the entire process from returning. This should not happen anymore.
  • Provide copy-able command to fetch outputs as part of progress reporting
  • Move APEX domain info into fetch-outputs task
  • Upgrade to [confetti/cloudformation "0.1.3"] to have :website-url in stack outputs no matter if Route53 is used or not
  • Print time when starting progress reporting
  • Print Cloudfront URL in fetch-outputs if Route53 isn't used

0.1.3

  • A fetch-outputs task has been added that can be used to download outputs of Cloudformation stacks. Previously the reporting often got stuck and didn't save stack outputs properly. To circumvent this you may now cancel the reporting and call fetch-outputs at any later point in time to download the outputs.
  • The sync-bucket task now provides a confetti-edn option that can be used to supply the some-id part of a {some-id}.confetti.edn. The information in that file will then be used for instead of the regular task options.
  • General improvements around error handling and option validation.

Appendix

Additional Tweaks

Add SSL:
  1. Get an SSL Cert using AWS Certificate Manager (ACM)
  2. Configure Cloudfront Distribution to use newly issued certificate (i.e. "Custom SSL certificate")
  3. Switch Behavior Viewer Protocol Policy to "Redirect HTTP to HTTPS"

๐Ÿ‘‰ If anything is not working as expected, please open an issue. ๐Ÿ‘ˆ

Note If you end up getting 504 errors when requesting assets from your Cloudfront distribution double check you're really using the website endpoint as origin. The Origin Protocol policy must be "HTTP Only" as a result of using the website endpoint.

Enable Gzipping
  • v0.1.6 and up now take care of this automatically
  • Edit Behavior, set "Compress Objects Automatically" to "Yes"

A Note On APEX Domains

Cloudfront supports APEX domains but only if you use Route53's ALIAS records. More information can be found in the official announcement.

This limitation makes it harder to automate root (APEX) domain setups thus it's currently not supported to create sites for root domains without also managing DNS with Route53.

confetti's People

Contributors

arichiardi avatar martinklepsch avatar mynomoto avatar podviaznikov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

confetti's Issues

create-site never finishes

$ boot -d confetti create-site --domain domain.name --access-key $AWS_ACCESS_KEY_ID --secret-key $AWS_SECRET_ACCESS_KEY --dns
Reporting events generated while creating your stack.
Be aware that creation of CloudFront distributions may take up to 15min.

 - [create-in-progress] AWS::CloudFormation::Stack - User Initiated
 - [create-in-progress] AWS::S3::Bucket
 - [create-in-progress] AWS::Route53::HostedZone
 - [create-in-progress] AWS::S3::Bucket - Resource creation Initiated
 - [create-in-progress] AWS::Route53::HostedZone - Resource creation Initiated
 - [create-complete] AWS::S3::Bucket
 - [create-in-progress] AWS::S3::BucketPolicy
 - [create-in-progress] AWS::CloudFront::Distribution
 - [create-in-progress] AWS::IAM::User
 - [create-in-progress] AWS::S3::BucketPolicy - Resource creation Initiated
 - [create-in-progress] AWS::IAM::User - Resource creation Initiated
 - [create-in-progress] AWS::CloudFront::Distribution - Resource creation Initiated
 - [create-complete] AWS::S3::BucketPolicy
 - [create-complete] AWS::Route53::HostedZone
 - [create-complete] AWS::IAM::User
 - [create-in-progress] AWS::IAM::AccessKey
 - [create-in-progress] AWS::IAM::AccessKey - Resource creation Initiated
 - [create-complete] AWS::IAM::AccessKey

The command has been stuck at this point for more than 30 minutes. The cloudfront distribution seems to have finished in the meantime.

Failed to contact the origin

After setting up a site automatically, when I visit the cloudfront url, I get the error message

ERROR

Failed to contact the origin.

Looking at the CloudFront settings, it looks like the S3 bucket is configured as a custom backend. To fix it I set it up to use the S3 bucket directly (you can select the S3 bucket you want from a list when creating an origin). The origin type is "S3 origin".

Exception while deploying a large number of files

The title is actually an attempt to an explanation, but it can be something else.

The exception is the following:

Deploying on bucket devel.clojurescript.io...
Pack source files...
Sifting output files...

             clojure.lang.ExceptionInfo: java.lang.RuntimeException: Method code too large!, compiling:(NO_SOURCE_PATH:0:0)
    data: {:file "/tmp/boot.user8095246900604741649.clj", :line 67}
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Method code too large!, compiling:(NO_SOURCE_PATH:0:0)
             java.lang.RuntimeException: Method code too large!
          clojure.asm.MethodWriter.getSize                 MethodWriter.java: 1872
       clojure.asm.ClassWriter.toByteArray                  ClassWriter.java:  775
                                       ...                                        
                         clojure.core/eval                          core.clj: 3081
                         boot.pod/eval-in*                           pod.clj:  437
                                       ...                                        
                         boot.pod/eval-in*                           pod.clj:  440
  confetti.boot-confetti/eval2817/fn/fn/fn                 boot_confetti.clj:  155
replumb.boot-pack-source/eval2560/fn/fn/fn              boot_pack_source.clj:   45
replumb.boot-pack-source/eval2606/fn/fn/fn              boot_pack_source.clj:   57
            boot.task.built-in/fn/fn/fn/fn                      built_in.clj:  416
               boot.user/eval3014/fn/fn/fn  boot.user8095246900604741649.clj:   45
                       boot.core/run-tasks                          core.clj:  927
                         boot.core/boot/fn                          core.clj:  937
       clojure.core/binding-conveyor-fn/fn                          core.clj: 1916
                                       ...                                        

I am basically including the following dependencies:
(def deps '[[org.clojure/clojurescript "1.7.228"]
[org.clojure/core.async "0.2.374"]
[reagent "0.5.1"]
[re-frame "0.5.0"]
[replumb/replumb "0.2.2-SNAPSHOT"]
[org.clojure/tools.reader "1.0.0-alpha3"]])

And the following task:

(core/deftask count-files
  []
  (core/with-pre-wrap fileset
    (util/warn "Fileset count %s" (count (tmpdir/ls fileset)))
    fileset))

I get Fileset count 1704. Maybe I am pushing it to the limit ๐Ÿ˜„

"Cannot create enum from eu-west-2 value"

Retrieving jsr-275-0.9.3.jar from https://repo1.maven.org/maven2/
             clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: Cannot create enum from eu-west-2 value!
    data: {:file
           "/var/folders/8j/27sz_2rj0kd1b3v9y4n1_1t00000gn/T/boot.user7464173975716694273.clj",
           :line 35}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Cannot create enum from eu-west-2 value!
     java.lang.IllegalArgumentException: Cannot create enum from eu-west-2 value!
                                                com.amazonaws.regions.Regions.fromName                     Regions.java:   71
   com.amazonaws.services.s3.internal.S3RequestEndpointResolver.resolveRequestEndpoint   S3RequestEndpointResolver.java:   68
com.amazonaws.services.s3.internal.S3V4AuthErrorRetryStrategy.redirectToRegionInHeader  S3V4AuthErrorRetryStrategy.java:   88
com.amazonaws.services.s3.internal.S3V4AuthErrorRetryStrategy.shouldRetryWithAuthParam  S3V4AuthErrorRetryStrategy.java:   73
                                 com.amazonaws.http.AmazonHttpClient.executeOneRequest            AmazonHttpClient.java:  781
                                     com.amazonaws.http.AmazonHttpClient.executeHelper            AmazonHttpClient.java:  489
                                           com.amazonaws.http.AmazonHttpClient.execute            AmazonHttpClient.java:  310
                                       com.amazonaws.services.s3.AmazonS3Client.invoke              AmazonS3Client.java: 3604
                                       com.amazonaws.services.s3.AmazonS3Client.invoke              AmazonS3Client.java: 3557
                                  com.amazonaws.services.s3.AmazonS3Client.listObjects              AmazonS3Client.java:  647
                                                                                   ...
                                                             amazonica.core/fn-call/fn                         core.clj:  789
                                                     amazonica.core/intern-function/fn                         core.clj:  860
                                                                                   ...
                                              confetti.s3-deploy/get-bucket-objects/fn                    s3_deploy.clj:   29
                                                 confetti.s3-deploy/get-bucket-objects                    s3_deploy.clj:   29
                                                              confetti.s3-deploy/sync!                    s3_deploy.clj:  134
                                                                   pod$eval3061.invoke                   NO_SOURCE_FILE
                                                                                   ...
                                                                     clojure.core/eval                         core.clj: 3081
                                                                     boot.pod/eval-in*                          pod.clj:  369
                                                                                   ...
                                                                     boot.pod/eval-in*                          pod.clj:  372
                                              confetti.boot-confetti/eval3106/fn/fn/fn                boot_confetti.clj:  276
                                                        boot.task.built-in/fn/fn/fn/fn                     built_in.clj:  402
                                                        boot.task.built-in/fn/fn/fn/fn                     built_in.clj:  402
                                                jeluard.boot-notify/eval11725/fn/fn/fn                  boot_notify.clj:   60
                                                            io.perun/eval2147/fn/fn/fn                        perun.clj:  396
                                                            io.perun/eval1651/fn/fn/fn                        perun.clj:  116
                                                                   boot.core/run-tasks                         core.clj:  794
                                                                     boot.core/boot/fn                         core.clj:  804
                                                   clojure.core/binding-conveyor-fn/fn                         core.clj: 1916
                                                                                   ...
>>> elapsed time 24m53s

file-map option needs some de-/serialization

Users are supposed to specify an edn file but edn can't easily hold java.io.File objects.

  • document file-map.edn should provide canonical paths (strings)
  • transform those paths into file objects before passing to sync!

Allow Record Set to be added to an existing HostedZone

A user might already have a hosted zone for abc.com but now wants to add a static CDN to cdn.abc.com. It would be possible to create a separate hosted zone but this would require adding this hosted zones nameservers to the domain introducing additional friction.

Alternatively confetti's Cloudformation tooling could check if a hosted zone for the root domain already exists. And optionally add the required record set to the existing hosted zone.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-recordset.html

Incorrect Clojure version

I cloned project locally and run boot

  confetti git:(master) boot
Downloading https://github.com/boot-clj/boot/releases/download/2.0.0/boot.sh...done.
clojure.lang.ExceptionInfo: Unable to resolve symbol: update in this context
    data: {:file "confetti/serialize.clj", :line 8}
java.lang.RuntimeException: Unable to resolve symbol: update in this context
                                           ...
                          clojure.core/load/fn                          core.clj

Probably you want to include boot.properties file int the repo with minimum requirements?

Clarify Readme regarding access key

The Readme currently says

Creating a site

Let's say you want to deploy a site at my-app.com. To create an S3 bucket, a CloudFront distribution and restricted access keys you can run the following:

This sounds like its saying that the access key and secret key will be created, but the function signature of create-site sounds like its expecting values for these options. I'm assuming I need to create an AWS user and create the access key ahead of time, so what does the Confetti Readme mean when it says it will create restricted access keys?

validate credentials?

Current assertion is useless

(assert creds "Credentials are required!")

maybe no validation is required since the utility libs validate things as well.

Problem creating site for root domain

I tried to use confetti for my clojurecup entry but hit following problem:
Tried to create site without dns (I wanted to use cloudflare). I used root domain (lifelines.io).
Got an error that it's not possible to create site for root domain without setting up dns.

Is this by design?

Auhentication warning during s3 sync

Mar 14, 2018 5:59:39 PM com.amazonaws.services.s3.internal.S3V4AuthErrorRetryStrategy buildRetryParams
WARNING: Attempting to re-send the request to testi-metosin-fi-sitebucket-1vvyctvha8ad5.s3.eu-central-1.amazonaws.com with AWS V4 authentication. To avoid this warning in the future, please use region-specific endpoint to access buckets located in regions that require V4 signing.
 - [update] blog/schema-spec-web-devs/index.html

The parameter previousObjectListing must be specified

When I re-deploy something, and I actually don't know what triggers the error at the moment, I get:

                clojure.lang.ExceptionInfo: 
    data: {:file "/tmp/boot.user6757680306871265920.clj", :line 67}
java.lang.reflect.InvocationTargetException: 
         java.lang.IllegalArgumentException: The parameter previousObjectListing must be specified.
com.amazonaws.services.s3.model.ListNextBatchOfObjectsRequest.setPreviousObjectListing  ListNextBatchOfObjectsRequest.java:   51
                  com.amazonaws.services.s3.model.ListNextBatchOfObjectsRequest.<init>  ListNextBatchOfObjectsRequest.java:   33

Do you have some hint on how to debug it?

Problem creating site

What I did:

  1. Cloned confetti locally and run boot build-jar
  2. Required confetti into my project boot file: https://github.com/hashobject/code.hashobject.com/blob/master/build.boot
  3. Run boot create-site --domain "code.hashobject.com"
  4. Got error:
clojure.lang.ExceptionInfo: java.lang.ClassNotFoundException: com.amazonaws.services.cloudsearchdomain.AmazonCloudSearchDomainClient, compiling:(amazonica/core.clj:1:1)
    data: {:file
           "/var/folders/7d/9c32qg7x2_z9slnznbhq2dg80000gn/T/boot.user7083640999180883928.clj",
           :line 27}
java.util.concurrent.ExecutionException: java.lang.ClassNotFoundException: com.amazonaws.services.cloudsearchdomain.AmazonCloudSearchDomainClient, compiling:(amazonica/core.clj:1:1)
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: com.amazonaws.services.cloudsearchdomain.AmazonCloudSearchDomainClient, compiling:(amazonica/core.clj:1:1)
       java.lang.ClassNotFoundException: com.amazonaws.services.cloudsearchdomain.AmazonCloudSearchDomainClient
                                                 ...
              amazonica.core/eval523/loading--auto--            core.clj:    1
                              amazonica.core/eval523            core.clj:    1
                                                 ...
                                clojure.core/load/fn            core.clj: 5866
                                   clojure.core/load            core.clj: 5865
                                                 ...
                               clojure.core/load-one            core.clj: 5671
                            clojure.core/load-lib/fn            core.clj: 5711
                               clojure.core/load-lib            core.clj: 5710
                                                 ...
                                  clojure.core/apply            core.clj:  632
                              clojure.core/load-libs            core.clj: 5749
                                                 ...
                                  clojure.core/apply            core.clj:  632
                                clojure.core/require            core.clj: 5832
                                                 ...
amazonica.aws.cloudformation/eval517/loading--auto--  cloudformation.clj:    1
                amazonica.aws.cloudformation/eval517  cloudformation.clj:    1
                                                 ...
                                clojure.core/load/fn            core.clj: 5866
                                   clojure.core/load            core.clj: 5865
                                                 ...
                               clojure.core/load-one            core.clj: 5671
                            clojure.core/load-lib/fn            core.clj: 5711
                               clojure.core/load-lib            core.clj: 5710
                                                 ...
                                  clojure.core/apply            core.clj:  632
                              clojure.core/load-libs            core.clj: 5749
                                                 ...
                                  clojure.core/apply            core.clj:  632
                                clojure.core/require            core.clj: 5832
                                                 ...
      confetti.cloudformation/eval58/loading--auto--  cloudformation.clj:    1
                      confetti.cloudformation/eval58  cloudformation.clj:    1
                                                 ...
                                clojure.core/load/fn            core.clj: 5866
                                   clojure.core/load            core.clj: 5865
                                                 ...
                               clojure.core/load-one            core.clj: 5671
                            clojure.core/load-lib/fn            core.clj: 5711
                               clojure.core/load-lib            core.clj: 5710
                                                 ...
                                  clojure.core/apply            core.clj:  632
                              clojure.core/load-libs            core.clj: 5749
                                                 ...
                                  clojure.core/apply            core.clj:  632
                                clojure.core/require            core.clj: 5832
                                                 ...
                                   pod$eval54.invoke      NO_SOURCE_FILE
                                                 ...
                                   clojure.core/eval            core.clj: 3081
                                   boot.pod/eval-in*             pod.clj:  224
                                                 ...
                                   boot.pod/eval-in*             pod.clj:  227
                     confetti.boot-confetti/prep-pod   boot_confetti.clj:   21
           confetti.boot-confetti/eval10209/fn/fn/fn   boot_confetti.clj:   56
                                 boot.core/run-tasks            core.clj:  730
                                   boot.core/boot/fn            core.clj:  740
                 clojure.core/binding-conveyor-fn/fn            core.clj: 1916
                                                 ...

sync-bucket NullPointerException

When I attempt to run sync-bucket, with or without -y switch, I get the following null pointer exception:

โฏ boot -d confetti sync-bucket --bucket my-bucket-redacted --access-key REDACTED --secret-key REDACTED --dir target/public
             clojure.lang.ExceptionInfo: java.lang.NullPointerException
    data: {:file
           "/var/folders/8j/27sz_2rj0kd1b3v9y4n1_1t00000gn/T/boot.user8801486601348864520.clj",
           :line 35}
java.util.concurrent.ExecutionException: java.lang.NullPointerException
         java.lang.NullPointerException:
                                     ...
confetti.boot-confetti/find-confetti-edn  boot_confetti.clj:   53
confetti.boot-confetti/read-confetti-edn  boot_confetti.clj:   58
 confetti.boot-confetti/eval282/fn/fn/fn  boot_confetti.clj:  223
                     boot.core/run-tasks           core.clj:  794
                       boot.core/boot/fn           core.clj:  804
     clojure.core/binding-conveyor-fn/fn           core.clj: 1916
                                     ...

The exact same error occurs when I run sync-bucket as part of a comp pipeline.

Updating of stacks

It might be useful to save the template in the working dir and allow users to modify it and update the existing stack that way.

Another possibility is to just recommend re-creating stacks if a change is desired. This might not help as much with customizations that are not directly supported at creation time though (e.g. CORS policies currently)

make create-site return earlier

an improvement could be to check if only cloudfront is outstanding and exit at that point with a note that it may take up to 10 more minutes to have the distribution synced

Required for that is that is that outputs for stacks can be fetched before creation is fully done.
Not sure if outputs are available before the stack is fully created.

Also cloudfront ID is a useful output value that most likely is not available before the distribution is fully created.

Cloudflare

I would suggest looking also into Cloudflare and potentially implement integration into confetti.

I want to share my current setup/process for static sites.

  1. I buy domain at namecheap.com
  2. I use stout which will create s3 bucket and cloudfront distribution
  3. I go to cloudflare, setup new domain.
  4. Change name servers in namecheap to point to cloudflare
  5. Setup CNAME in the cloudflare pointing to the cloudfront distribution host
  6. Setup page rules in cloudflare to automatically redirect http to https

I used to use Route53 before cloudflare. But now I think Cloudflare is better because:

  1. it's free and for Route53 you still need to pay
  2. it has free SSL, not setup required
  3. it has caching features, analytics etc

It seems that cloudflare has nice API and I suggest looking into it so instead of setting up Route53 and provisioning certificates user would be able to get same features using cloudflare (and for free).
I think if I have cloudflare support I would use confetti instead of stout:)

Update objects when metadata changed

I'm using :cache-control metadata for caching purposes but confetti doesn't update objects when the file has not changed and the metadata has. Not sure if it should but it would be nice if it did ;-)
Fell free to close it if this is not a reasonable feature for the library.

Revisit instructions

  • DNS configuration
  • SSL setup
  • Adding GZIP
  • Future Improvements is outdated
  • Who is this for?

Names

  • bloy (via namewhale)

Provide way to create Cloudformation template

I'm not going to let any program access AWS with keys that can do lots of things. Maybe there is a way to create proper IAM role with only necessary policies to allow stack creation, but I don't know how that would work.

But good way allow stack creation manually would be to add option (or modify --dry-run) to print the CloudFormation JSON or Yaml template. User can then check the template is fine and create the stack from AWS Console.

Instead of pprint here, https://github.com/confetti-clj/confetti/blob/master/src/confetti/boot_confetti.clj#L193 this could call cheshire/generate-string or similar (with key-fn that converts snake-case to CamelCase). Amazonica probably already has a function to translate clj data to JSON.

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.