Skip to content

Commit

Permalink
deploy hashiqube website with waypoint, work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
star3am committed Jun 23, 2023
1 parent f82a4b0 commit 74152e8
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/.git
**.vagrant
*.log
**.DS_Store
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile-Hashiqube-com
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# https://docsify.js.org/#/deploy?id=docker

FROM node:latest
LABEL description="Hashiqube"
COPY . /app
WORKDIR /app
RUN npm install -g docsify-cli@latest
EXPOSE 3000/tcp
ENTRYPOINT docsify serve --port 3000 .
177 changes: 177 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,182 @@ Videos were made with asciinema https://asciinema.org/
- asciinema rec -i 1
- asciicast2gif -S 1 -s 2 tmpd1zpq13n-ascii.cast tmpd1zpq13n-ascii.gif

## Hashiqube.com
__WORK IN PROGRESS__

As you can already imagine, I am using Hashicorp tools to deploy Hashiqube.com website - For this I use Hashiqube and more specifically, Waypoint.

### Bring up Hashiqube locally
`vagrant up --provision-with basetools,docker,terraform,nomad,waypoint`

### SSH into Hashiqube
`vagrant ssh`

### Set AWS Credentials
`~/.aws/config`
```
[default]
region =
aws_access_key_id =
aws_secret_access_key =
output = json
```

### Change Directory
`cd /vagrant`

### Waypoint Init
```log
✓ Configuration file appears valid
✓ Connection to Waypoint server was successful
✓ Project "hashiqube" and all apps are registered with the server.
✓ Project "hashiqube" pipelines are registered with the server.
Project initialized!
You may now call 'waypoint up' to deploy your project or
commands such as 'waypoint build' to perform steps individually.
```
### Waypoint Up to build and deploy
`waypoint up`

```log
» Performing operation locally
» Building hashiqube...
✓ Running build v6
✓ All services available.
✓ Set ECR Repository name to 'hashiqube'
✓ Initializing Docker client...
✓ Building image...
│ Step 6/7 : EXPOSE 3000/tcp
│ ---> Running in 23af06f1e141
│ Removing intermediate container 23af06f1e141
│ ---> 1ec08a9809e7
│ Step 7/7 : ENTRYPOINT docsify serve --port 3000 .
│ ---> Running in 979e0a2b31ba
│ Removing intermediate container 979e0a2b31ba
│ ---> ce95edf92a1d
│ Successfully built ce95edf92a1d
│ Successfully tagged waypoint.local/hashiqube:latest
✓ Injecting Waypoint Entrypoint...
Image built: waypoint.local/hashiqube:latest (arm64)
✓ Running push build v3
✓ All services available.
✓ Set ECR Repository name to 'hashiqube'
✓ Tagging Docker image: waypoint.local/hashiqube:latest => 241803818300.dkr.ecr.ap-southeast-2.amazonaws.com/hashiqube:latest
✓ Pushing Docker image...
│ b834e6addace: Layer already exists
│ 01cc858d0ddb: Layer already exists
│ 9c1364bce9cb: Layer already exists
│ a85b326ea208: Layer already exists
│ bebb780c89cf: Layer already exists
│ 611bfb08f71c: Layer already exists
│ 0008bb42e2e6: Layer already exists
│ b89248fb99be: Layer already exists
│ latest: digest: sha256:fb440d4946c6195d44106bb100b4761c0e2e5b74ae211c14339388462
│ 5e82f05 size: 2639
✓ Docker image pushed: 241803818300.dkr.ecr.ap-southeast-2.amazonaws.com/hashiqube:latest
» Deploying hashiqube...
✓ Running deploy v3
✓ Deployment resources created
✓ Discovered alb subnets
✓ Discovered service subnets
✓ Using existing execution IAM role "ecr-hashiqube"
✓ Using existing log group waypoint-logs
✓ Registered Task definition: waypoint-hashiqube
✓ Using external security group hashiqube-inbound
✓ Using internal security group hashiqube-inbound-internal
✓ Created target group hashiqube-01H3KF9QR2CYEM6NPC334A
✓ Using Application Load Balancer "waypoint-ecs-hashiqube"
✓ Created ALB Listener
✓ Using existing ECS cluster waypoint
✓ Created ECS Service hashiqube-01H3KF9QR2CYEM6NPC334A
✓ Finished building report for ecs deployment
✓ Determining status of ecs service hashiqube-01H3KF9QR2CYEM6NPC334A
✓ Found existing ECS cluster: waypoint
⚠️ 1 cluster READY, 1 service READY, 1 task MISSING
⚠️ Waypoint detected that the current deployment is not ready, however your application
might be available or still starting up.
✓ Finished building report for ecs deployment
✓ Determining status of ecs service hashiqube-01H3KF9QR2CYEM6NPC334A
✓ Found existing ECS cluster: waypoint
⚠️ 1 cluster READY, 1 service READY, 1 task MISSING
⚠️ Waypoint detected that the current deployment is not ready, however your application
might be available or still starting up.
» Releasing hashiqube...
✓ Running release v3
✓ Release initialized
✓ All targets are healthy!
✓ Finished ECS release
» Variables used:
VARIABLE | VALUE | TYPE | SOURCE
-----------+-------+------+---------
The deploy was successful! A Waypoint deployment URL is shown below. This
can be used internally to check your deployment and is not meant for external
traffic. You can manage this hostname using "waypoint hostname."
Release URL: http://waypoint-ecs-hashiqube-117608968.ap-southeast-2.elb.amazonaws.com
Deployment URL: https://sharply-composed-flea--v3.waypoint.run
```

### Waypoint Destroy
`waypoint destroy`

```log
Do you really want to destroy all resources for this app? Only 'yes' will be accepted to approve: yes
» Performing operation locally
» Destroying releases for application 'hashiqube'...
✓ Running release destroy v3
...
✓ Running release destroy v3
» Destroying deployments for application 'hashiqube'...
✓ Running deployment destroy v3
✓ Finished destroying ECS deployment
✓ Deleted service hashiqube-01H3KF9QR2CYEM6NPC334A
✓ Deleted ALB Listener
✓ Retrieved target group details
✓ ALB listener for target group is deleted
✓ Target group deleted
These resources were not destroyed for app "hashiqube":
- route53 record
- cluster
- execution role
- log group
- internal security groups
- service subnets
- task role
- alb subnets
These resources were destroyed for app "hashiqube":
- external security groups
- alb listener
- task definition
- service
- application load balancer
- target group
» Destroying shared deploy resources for application 'hashiqube'...
✓ Finished destroying ECS deployment
✓ ALB is managed by Waypoint - proceeding with deletion
✓ Deleted ALB arn:aws:elasticloadbalancing:ap-southeast-2:241803818300:loadbalancer/app/waypoint-ecs-hashiqube/ed3b1d6b31e1b58d
✓ Deleted security group sg-03f10a91f6ee3d10a
✓ Deleted security group sg-0fe1d9ac18497255d
✓ Deleted ECS task definition
Destroy successful!
```

## License
HashiQube is available as open-source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1 change: 1 addition & 0 deletions hashicorp/nomad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ client {
# https://github.com/hashicorp/nomad/issues/5562
options = {
"docker.volumes.enabled" = true
"docker.auth.config" = "/etc/docker/auth.json"
}
host_volume "waypoint" {
path = "/opt/nomad/data/volume/waypoint"
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<div id="app"></div>
<script>
window.$docsify = {
routerMode: 'hash', //history see: https://github.com/docsifyjs/docsify/issues/238#issuecomment-1065320116
routerMode: 'hash', //hash (default) or history WORK IN PROGRESS (SEO URLs) (history does not work on github pages) see: https://github.com/docsifyjs/docsify/issues/238#issuecomment-1065320116
notFoundPage: '/',
nameLink: '/',
basePath: '/',
Expand Down
32 changes: 32 additions & 0 deletions waypoint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
project = "hashiqube"

app "hashiqube" {
labels = {
"service" = "hashiqube",
"env" = "dev"
}

build {
use "docker" {
dockerfile = "./Dockerfile-Hashiqube-com"
no_cache = true
}
registry {
use "aws-ecr" {
region = "ap-southeast-2"
repository = "hashiqube"
tag = "latest"
}
}
}

deploy {
use "aws-ecs" {
region = "ap-southeast-2"
memory = "512"
# https://github.com/hashicorp/waypoint/pull/3068
architecture = "arm64"
}
}

}

0 comments on commit 74152e8

Please sign in to comment.