Skip to content

Commit 1572e0e

Browse files
committed
docs: deployment improvements
1 parent ec0a4e5 commit 1572e0e

File tree

1 file changed

+28
-7
lines changed
  • adminforth/documentation/blog/2025-02-19-compose-ec2-deployment-ecr-ci

1 file changed

+28
-7
lines changed

adminforth/documentation/blog/2025-02-19-compose-ec2-deployment-ecr-ci/index.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,17 @@ sudo apt update && sudo apt install terraform
109109
```
110110

111111

112-
And AWS CLI:
112+
AWS CLI:
113113

114114
```bash
115115
sudo snap install aws-cli --classic
116116
```
117117

118+
Also you need Doker Daemon running. We recommend Docker Desktop running. ON WSL2 make sure you have Docker Desktop WSL2 integration enabled.
119+
120+
```bash
121+
docker version
122+
```
118123

119124
# Practice - deploy setup
120125

@@ -651,7 +656,9 @@ aws_secret_access_key = <your_secret_key>
651656

652657
We will run first deployment from local machine to create S3 bucket for storing Terraform state. In other words this deployment will create resources needed for storing Terraform state in the cloud and runnign deployment from GitHub actions.
653658

654-
```bash
659+
In `deploy` folder run:
660+
661+
```bash
655662
terraform init
656663
```
657664

@@ -788,14 +795,14 @@ jobs:
788795
```
789796

790797

791-
### Step 8.1 - Add secrets to GitHub
798+
### Step 10 - Add secrets to GitHub
792799

793800
Go to your GitHub repository, then `Settings` -> `Secrets` -> `New repository secret` and add:
794801

795802
- `VAULT_AWS_ACCESS_KEY_ID` - your AWS access key
796803
- `VAULT_AWS_SECRET_ACCESS_KEY` - your AWS secret key
797-
- `VAULT_SSH_PRIVATE_KEY` - execute `cat ~/.ssh/id_rsa` and paste to GitHub secrets
798-
- `VAULT_SSH_PUBLIC_KEY` - execute `cat ~/.ssh/id_rsa.pub` and paste to GitHub secrets
804+
- `VAULT_SSH_PRIVATE_KEY` - execute `cat deploy/.keys/id_rsa` and paste to GitHub secrets
805+
- `VAULT_SSH_PUBLIC_KEY` - execute `cat deploy/.keys/id_rsa.pub` and paste to GitHub secrets
799806
- `VAULT_REGISTRY_CA_PEM` - execute `cat deploy/.keys/ca.pem` and paste to GitHub secrets
800807
- `VAULT_REGISTRY_CA_KEY` - execute `cat deploy/.keys/ca.key` and paste to GitHub secrets
801808
- `VAULT_ADMINFORTH_SECRET` - generate some random string and paste to GitHub secrets, e.g. `openssl rand -base64 32 | tr -d '\n'`
@@ -832,6 +839,16 @@ Now open GitHub actions file and add it to the `env` section:
832839

833840
In the same way you can add any other secrets to your GitHub actions.
834841

842+
### How to connect to EC2 instance?
843+
844+
To connect to EC2 instance you can use SSH.
845+
846+
```bash
847+
cd deploy
848+
ssh -i ./.keys/id_rsa ubuntu@<your_ec2_ip>
849+
```
850+
851+
IP address can be found in terminal output after terraform apply.
835852

836853
### Out of space on EC2 instance? Extend EBS volume
837854

@@ -903,14 +920,18 @@ Add this steps to the end of your GitHub actions file:
903920
run: |
904921
curl -X POST -H 'Content-type: application/json' --data \
905922
"{\"text\": \"✅ *${{ github.actor }}* successfully built *${{ github.ref_name }}* with commit \\\"${{ github.event.head_commit.message }}\\\".\n:link: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build> | :link: <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|View Commit>\"}" \
906-
${{ secrets.SLACK_WEBHOOK_URL }}
923+
$SLACK_WEBHOOK_URL
924+
env:
925+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
907926
908927
- name: Notify Slack on failure
909928
if: failure()
910929
run: |
911930
curl -X POST -H 'Content-type: application/json' --data \
912931
"{\"text\": \"❌ *${{ github.actor }}* failed to build *${{ github.ref_name }}* with commit \\\"${{ github.event.head_commit.message }}\\\".\n:link: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build> | :link: <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|View Commit>\"}" \
913-
${{ secrets.SLACK_WEBHOOK_URL }}
932+
$SLACK_WEBHOOK_URL
933+
env:
934+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
914935
915936
```
916937

0 commit comments

Comments
 (0)