static-deployer
What is static-deployer?
static-deployer aims to simplify the deploy and rollback of your static website (frontend) to AWS using a single command. It still does not create the AWS resources for you, so you need to have a previously configured S3 bucket and a CloudFront distribution configured with an origin to your S3 bucket. The credentials you will use to run the static-deployer need to have permission List+Read+Write permissions to the specified bucket and cloudfront distribution.
How to install?
pip3 install static-deployer
How to configure the AWS credentials?
We recomend using aws-vault because it does not store your credentials in plaintext. But you can also use aws-cli.
After installing aws-vault, add a new profile using the following command:
aws-vault add mysite
How to deploy a static website?
aws-vault exec mysite -- static-deployer deploy \
--root-dir ROOT_DIR \
--patterns PATTERNS \
--bucket-name BUCKET_NAME \
--distribution-id DISTRIBUTION_ID \
--origin-name ORIGIN_NAME \
--version VERSION
--cache-maxage "1 hour"
The deploy does the following:
- Finds all files from
ROOT_DIR, including only those that match the patterns specified inPATTERNS(comma separated); - Unside the bucket specified by
BUCKET_NAME, creates a new folder/directory with the name specified inVERSION; - Uploads all files to the folder/directory created in step 2;
- Changes the CloudFront distribution
DISTRIBUTION_IDorigin namedORIGIN_NAMEto point the folder/directory created in step 2; - Invalidates the CloudFront distribution
DISTRIBUTION_IDcache using the pattern/*; - Waits for the distribution changes to complete.
How to rollback to a previous deployed version?
static-deployer rollback \
--bucket-name BUCKET_NAME \
--distribution-id DISTRIBUTION_ID \
--origin-name ORIGIN_NAME \
--version VERSION
The rollback does the following:
- Changes the CloudFront origin
ORIGIN_NAMEto point to a previously deployed version specified byVERSION. - Waits for the distribution changes to complete.
Example of config file config.toml
dry_run = "false"
[content]
root_dir = "public"
patterns = "**"
[storage]
name = "your-website-domain.com"
prefix = "{{version}}"
cache_maxage = "1 hour"
[cdn]
distribution_id = "your-cloudfront-distribution-id"
origin_name = "your-cloudfront-origin-name"
How to use the config file?
static-deployer -c config.toml deploy --version VERSION
Once you have settings in a config file, you can tell static-deployer to use the config file by using the arguments -c yourfile.toml.
By specifying a config file, you eliminate the need of informing all parameters at every invocation. You're then required to inform only the missing parameters.
The command-line arguments override any settings you have in the config file.
Metadata
Release files for static-deployer 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| static-deployer-0.1.5.tar.gz | 13.3 kB | Without provenance | Details for static-deployer-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| static_deployer-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for static_deployer-0.1.5-py3-none-any.whl |
Total release size: 27.7 kB
Release files / static-deployer-0.1.5.tar.gz
| Download URL | static-deployer-0.1.5.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1e4363653b2b25dfda8e2fa9f3191504b89502951a69713387ec1cf38a0b4cb
|
|
BLAKE2b-256 checksum How to use checksums |
527d4377ac36ab072ea42af1375e7fe829800b490aa3c8dd40dadef48d626ba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / static_deployer-0.1.5-py3-none-any.whl
| Download URL | static_deployer-0.1.5-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2a31ad904a91894aeca39449935031403dd8b88288a49721756ff33504367c4
|
|
BLAKE2b-256 checksum How to use checksums |
0158909d8a737a5a1e0b8057d86ad7e6eb66f52a8fef64526e8815c79b054361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for static-deployer 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.