Skip to content

Commit

Permalink
Merge pull request #158 from hunghvu/development
Browse files Browse the repository at this point in the history
Incremental changes to adopt IPv6
  • Loading branch information
hunghvu authored Apr 14, 2024
2 parents f856704 + f96f5b7 commit 040e7b9
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 87 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build-and-push-caddy.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Author: Hung Vu
# Granular action for only build and push caddy image
name: Build and push Caddy image to ghcr.io
name: Build and push Caddy image to Docker Hub

on:
workflow_dispatch:
Expand All @@ -12,7 +12,7 @@ jobs:
matrix:
include:
- dockerfile: ./infras/containers/caddy/Dockerfile
image: ghcr.io/hunghvu/blogfolio-caddy
image: docker.io/hunghvu/blogfolio-caddy
permissions:
contents: read
packages: write
Expand All @@ -29,12 +29,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker images
id: meta
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/build-and-push-cms.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Author: Hung Vu
# Granular action for only build and push cms image
name: Build and push CMS image to ghcr.io
name: Build and push CMS image to Docker Hub

on:
workflow_dispatch:
Expand All @@ -12,7 +12,7 @@ jobs:
matrix:
include:
- dockerfile: ./apps/cms/Dockerfile
image: ghcr.io/hunghvu/blogfolio-cms
image: docker.io/hunghvu/blogfolio-cms
permissions:
contents: read
packages: write
Expand All @@ -29,12 +29,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker images
id: meta
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/build-and-push-web.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Author: Hung Vu
# Granular action for only build and push web image
name: Build and push Web image to ghcr.io
name: Build and push Web image to Docker Hub

on:
workflow_dispatch:
Expand Down Expand Up @@ -29,12 +29,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
- name: Login to Docker Hub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker images
id: meta
Expand Down
14 changes: 2 additions & 12 deletions infras/aws/services/ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ec2 = new awsClassic.ec2.Instance("ec2", {
cpuCredits: "standard",
},
iamInstanceProfile: iam.ec2InstanceProfile.name,
ipv6AddressCount: 1,
// TODO: Config userData
// Change SSH default port
// Restrict SSH to only public key
Expand All @@ -64,16 +65,5 @@ const ec2 = new awsClassic.ec2.Instance("ec2", {
`,
});

// It seems either Elastic IP makes AWS automatically populating public IPv4 and DNS at the same time
// Or, Pulumi sets them both for us
const elasticIp = new awsClassic.ec2.Eip("elastic-ip", {});
const elasticIpAssociation = new awsClassic.ec2.EipAssociation("elastic-ip-association", {
instanceId: ec2.id,
allocationId: elasticIp.id,
});

export const amiId = ami.id;
export const ec2Id = ec2.id;
export const elasticIpId = elasticIp.id;
export const elasticIpAssociationId = elasticIpAssociation.id;
export const elasticIpPublicIp = elasticIp.publicIp;
export const ec2Id = ec2.id;
Loading

0 comments on commit 040e7b9

Please sign in to comment.