Skip to content

Commit da3edef

Browse files
#6 Add readme (#10)
* #6 Add readme
1 parent 7938a5b commit da3edef

File tree

2 files changed

+129
-16
lines changed

2 files changed

+129
-16
lines changed

README.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,116 @@
1-
# github-actions-deploy-stackstorm
1+
# Deploy StackStorm
2+
3+
GitHub action to deploy [StackStorm](https://stackstorm.com/) to an AWS VM (EC2).
4+
5+
## Prerequisites
6+
- An [AWS account](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/) and [Access Keys](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-appendix-sign-up.html)
7+
- The following secrets should be added to your GitHub actions secrets:
8+
- AWS_ACCESS_KEY_ID
9+
- AWS_SECRET_ACCESS_KEY
10+
- ST2_AUTH_USERNAME
11+
- ST2_AUTH_PASSWORD
12+
13+
14+
## Example usage
15+
16+
Create `.github/workflow/deploy.yaml` with the following to build on push.
17+
18+
```yaml
19+
name: Deploy ST2 Single VM with GHA
20+
21+
on:
22+
push:
23+
branches: [ main ]
24+
25+
26+
jobs:
27+
deploy:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- id: deploy
31+
name: Deploy
32+
uses: bitovi/github-actions-deploy-stackstorm@main
33+
with:
34+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID}}
35+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
36+
aws_default_region: us-east-1
37+
st2_auth_username: ${{ secrets.ST2_AUTH_USERNAME}}
38+
st2_auth_password: ${{ secrets.ST2_AUTH_PASSWORD}}
39+
```
40+
41+
This will create the following resources in AWS:
42+
- An EC2 instance
43+
- A load balancer
44+
- Security groups
45+
- Optionally, a VPC with subnets
46+
47+
> For more details about what is created, see `operations/deployment/terraform/modules`
48+
49+
## Customizing
50+
51+
### Inputs
52+
53+
The following inputs can be used as `step.with` keys
54+
55+
| Name | Type | Default | Description |
56+
|------------------|---------|-------------|------------------------------------|
57+
| `checkout` | Bool | true | Specifies if this action should checkout the code (i.e. whether or not to run the `uses: actions/checkout@v3` action prior to deploying so that the deployment has access to the repo files) |
58+
| `aws_access_key_id` | String | | AWS access key ID (Required) |
59+
| `aws_secret_access_key` | String | | AWS secret access key (Required) |
60+
| `aws_session_token` | String | | AWS session token |
61+
| `aws_default_region` | String | us-east-1 | AWS default region (Required) |
62+
| `tf_state_bucket` | String | `${org}-${repo}-{branch}-tf-state` | AWS S3 bucket to use for Terraform state. |
63+
| `ec2_instance_profile` | String | | The AWS IAM instance profile to use for the EC2 instance |
64+
| `ec2_instance_type` | String | t2.medium | The AWS EC2 instance type. |
65+
| `stack_destroy` | Bool | false | Set to "true" to Destroy the stack |
66+
| `aws_resource_identifier` | String | `${org}-{repo}-{branch}` | Set to override the AWS resource identifier for the deployment. Use with destroy to destroy specific resources. |
67+
| `aws_create_vpc` | Bool | false | Whether an AWS VPC should be created in the action. |
68+
| `st2_auth_username` | String | | Username used by StackStorm standalone authentication |
69+
| `st2_auth_password` | String | | Password used by StackStorm standalone authentication |
70+
| `st2_packs` | String |`"st2"` | Comma separated list of packs to install. This flag does not work with a --python3 only pack.. If you modify this option, be sure to also include `st2` in the list. |
71+
| `infrastructure_only` | Bool | false | Does infrastructure (i.e. terraform) but **not** the deployment (i.e. ansible) |
72+
73+
74+
## Note about resource identifiers
75+
76+
Most resources will contain the tag GITHUB_ORG-GITHUB_REPO-GITHUB_BRANCH, some of them, even the resource name after.
77+
We limit this to a 60 characters string because some AWS resources have a length limit and short it if needed.
78+
79+
We use the kubernetes style for this. For example, kubernetes -> k(# of characters)s -> k8s. And so you might see some compressions are made.
80+
81+
For some specific resources, we have a 32 characters limit. If the identifier length exceeds this number after compression, we remove the middle part and replace it for a hash made up from the string itself.
82+
83+
### S3 buckets naming
84+
85+
Buckets name can be made of up to 63 characters. If the length allows us to add `-tf-state`, we will do so. If not, a simple `-tf` will be added.
86+
87+
## Made with BitOps
88+
[BitOps](https://bitops.sh) allows you to define Infrastructure-as-Code for multiple tools in a central place. This action uses a BitOps [Operations Repository](https://bitops.sh/operations-repo-structure/) to set up the necessary Terraform and Ansible to create infrastructure and deploy to it.
89+
90+
## Future
91+
In the future, this action will support more cloud providers (via [BitOps Plugins](https://bitops.sh/plugins/) like [AWS](https://github.com/bitops-plugins/aws)) such as
92+
- [Google Cloud Platform](https://cloud.google.com/gcp)
93+
- [Microsoft Azure](https://azure.microsoft.com/en-us/)
94+
- [Nutanix](https://www.nutanix.com/)
95+
- [Open Stack](https://www.openstack.org/)
96+
- [VMWare](https://www.vmware.com/)
97+
- etc
98+
99+
This action will also support multiple deployment types such as:
100+
- [Kubernetes](https://github.com/StackStorm/stackstorm-k8s)
101+
- Multi-VM
102+
103+
## Contributing
104+
We would love for you to contribute to [bitovi/github-actions-deploy-docker-to-ec2](https://github.com/bitovi/github-actions-deploy-docker-to-ec2). [Issues](https://github.com/bitovi/github-actions-deploy-docker-to-ec2/issues) and [Pull Requests](https://github.com/bitovi/github-actions-deploy-docker-to-ec2/pulls) are welcome!
105+
106+
## License
107+
The scripts and documentation in this project are released under the [MIT License](https://github.com/bitovi/github-actions-deploy-docker-to-ec2/blob/main/LICENSE).
108+
109+
## Provided by Bitovi
110+
[Bitovi](https://www.bitovi.com/) is a proud supporter of Open Source software.
111+
112+
113+
## Need help?
114+
Bitovi has consultants that can help. Drop into [Bitovi's Community Slack](https://www.bitovi.com/community/slack), and talk to us in the `#devops` channel!
115+
116+
Need DevOps Consulting Services? Head over to https://www.bitovi.com/devops-consulting, and book a free consultation.

action.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ inputs:
2424
tf_state_bucket:
2525
description: 'AWS S3 bucket to use for Terraform state. Defaults to `${org}-${repo}-{branch}-tf-state`'
2626
required: false
27-
dot_env:
28-
description: '`.env` file to be used with the app'
29-
required: false
3027
ec2_instance_profile:
3128
description: 'The AWS IAM instance profile to use for the EC2 instance'
3229
ec2_instance_type:
@@ -35,22 +32,22 @@ inputs:
3532
description: 'Set to "true" to Destroy the stack'
3633
aws_resource_identifier:
3734
description: 'Set to override the AWS resource identifier for the deployment. Defaults to `${org}-{repo}-{branch}`. Use with destroy to destroy specific resources.'
38-
domain_name:
39-
description: 'Define the root domain name for the application. e.g. app.com'
40-
required: true
35+
# domain_name:
36+
# description: 'Define the root domain name for the application. e.g. app.com'
37+
# required: true
4138
# create_domain:
4239
# description: "Bool, whether the domain should be created in the action. Default is false"
4340
# default: false
44-
sub_domain:
45-
description: 'Define the sub-domain part of the URL. Defaults to `${org}-${repo}-{branch}`'
41+
# sub_domain:
42+
# description: 'Define the sub-domain part of the URL. Defaults to `${org}-${repo}-{branch}`'
4643
# create_hosted_zone:
4744
# description: "Bool, whether the hosted zone should be created in the action. Default is false"
4845
# default: false
49-
create_vpc:
50-
description: "Bool, whether a VPC should be created in the action. Default is false"
46+
aws_create_vpc:
47+
description: "Bool, whether an AWS VPC should be created in the action. Default is false"
5148
default: false
5249
infrastructure_only:
53-
description: "Bool, does infrastructure (i.e. terraform) but **not** the deployment (i.e. ansible) . Default is true"
50+
description: "Bool, does infrastructure (i.e. terraform) but **not** the deployment (i.e. ansible) . Default is false"
5451
default: false
5552

5653

@@ -85,20 +82,21 @@ runs:
8582
AWS_SESSION_TOKEN: ${{ inputs.aws_session_token }}
8683
AWS_DEFAULT_REGION: ${{ inputs.aws_default_region }}
8784
TF_STATE_BUCKET: ${{ inputs.tf_state_bucket }}
88-
DOT_ENV: ${{ inputs.dot_env }}
8985
APP_PORT: ${{ inputs.app_port }}
9086
EC2_INSTANCE_PROFILE: ${{ inputs.ec2_instance_profile }}
9187
EC2_INSTANCE_TYPE: ${{ inputs.ec2_instance_type }}
9288
STACK_DESTROY: ${{ inputs.stack_destroy }}
9389
AWS_RESOURCE_IDENTIFIER: ${{ inputs.aws_resource_identifier }}
94-
DOMAIN_NAME: ${{ inputs.domain_name }}
90+
# DOMAIN_NAME: ${{ inputs.domain_name }}
9591
# CREATE_DOMAIN: ${{ inputs.CREATE_DOMAIN }}
96-
SUB_DOMAIN: ${{ inputs.sub_domain }}
92+
# SUB_DOMAIN: ${{ inputs.sub_domain }}
9793
# CREATE_HOSTED_ZONE: ${{ inputs.CREATE_HOSTED_ZONE }}
98-
CREATE_VPC: ${{ inputs.create_vpc }}
94+
95+
CREATE_VPC: ${{ inputs.aws_create_vpc }}
9996

10097
# Skip ansible deployment if deploying only infrastructure
10198
ANSIBLE_SKIP_DEPLOY: ${{ inputs.infrastructure_only }}
99+
102100
BITOPS_FAST_FAIL: true
103101

104102
# ST2 config

0 commit comments

Comments
 (0)