Coder Social home page Coder Social logo

niklasenb / amazon_static_site Goto Github PK

View Code? Open in Web Editor NEW

This project forked from igorkasyanchuk/amazon_static_site

0.0 1.0 0.0 3.34 MB

Static website using https with your own domain name using Amazon S3 and Cloudflare for FREE

Home Page: https://www.railsjazz.com/

License: MIT License

Ruby 78.34% Shell 0.57% CSS 2.05% HTML 19.04%

amazon_static_site's Introduction

Static Site using Amazon S3 + Cloudflare + HTTPS

RailsJazz

Upload static HTML/CSS/JS to the Amazon S3 and host HTTPS website for free using Cloudflare.

This tool allows you to upload a folder with your files to S3, configure for you Cloudflare account and map it all together so you will get a site with HTTPS.

This gem was used to deploy my site to production. So it's ready for everyday use.

DEMO

demo upload file to s3

Installation

  1. Install gem:
  $ gem install amazon_static_site

And run

  amazon_static_site generate site123
  cd site123

Edit config.yml.

  1. You need to have account on Amazon, you need to get API access_key_id and secret_access_key from Amazon: https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html

  2. You need to have an account on https://www.cloudflare.com/, and copy API-key from settings: https://support.cloudflare.com/hc/en-us/articles/200167836-Managing-API-Tokens-and-Keys

  3. You need to configure settings file, where you need to put your Amazon S3 keys, Cloudflare keys, and settings for a domain.

  4. Run this CLI amazon_static_site deploy <path-to-config> <path-to-public-folder>

  5. Check the previous logs, you will see settings for nameservers which you need to put (one time) on your hosting provider (where you host your domain), and wait few minutes/hours until DNS will be updated.

  6. You could make a changes to the HTML/CSS/JS and re-upload files. This time, you don't need to change nameservers.

Usage

amazon_static_site deploy ./template/config.yml ./template/public

You can use generator amazon_static_site generate <app>.

Local development

amazon_static_site serve ./template/config.yml ./template/public

Options

domain:
  primary: "www.railsjazz.com"
  secondary: "railsjazz.com"
s3:
  region: us-west-1
  access_key_id: "XXXXXXXXXXXXXXXXXXXXXXX"
  secret_access_key: "YYYYYYYYYYYYYYYYYYYYYYYYYYYY"
cloudflare:
  email: [email protected]
  api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

React app

For example you can create React app using create-react-app, do some coding, after this run yarn build and then copy files from build/* to the public folder to the generated amazon_static_site path. Or specify this build folder as public folder option.

amazon_static_site deploy ./config.yml /path/to/react-app/build

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

TODO

  • Check "non-www" domains
  • Tests
  • Better documentation

Contributing

You are welcome to contribute.

License

The gem is available as open source under the terms of the MIT License.

amazon_static_site's People

Contributors

igorkasyanchuk avatar

Watchers

James Cloos 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.