Skip to content

Commit 75e909a

Browse files
jatobrunalejandra-ponceLuisMS7semantic-release-botfaustocv
authored
feat: TT-509 Use terraform to provision ui infraestructure (#819)
* feat: TT-509 Use terraform to provision ui infraestructure * feat: TT-580 Missing placeholders (#820) * feat: TT-580 Missing placeholders * feat: TT-580 add placeholders in ticket uri and description text inputs on the time clock page Co-authored-by: Luis Moyon <[email protected]> * chore(release): 1.66.0 [skip ci]nn * TT-xx: Fix make publish tasks (#822) * fix: TT-509 expose port 8080 in docker images * fix: TT-509 change app to port 80 * feat: TT-578 improve the style of the form element (#823) * feat: TT-578 improve the style of the form element * chore(release): 1.67.0 [skip ci]nn * TT-582 Improve the summary section of the time-clock page and the clock out button (#824) * style: TT-582 improve the summary section with a new row with information of actual clock in register and clock out button * fix: TT-582 add missing unit test to confirm that clockout function in TimeEntriesSummaryComponent emits an event * style: TT-582 add a border radius to current elapsed time box Co-authored-by: David Cadena <[email protected]> * fix: TT-509 including empty line in all files * fix: TT-509 Change the dockerfile to use root user and not app user * feat: TT-576 Improve grids visual presentation and function (#826) * feat: TT-576 Improve grids visual presentation and function * chore(release): 1.68.0 [skip ci]nn * feat: TT-577 get profile pic from Google account (#825) * feat: TT-577 get profile pic from Google account * feat: TT-577 get profile pic from Google account * feat: TT-577 get profile pic from Google account Co-authored-by: alejandra-ponce <[email protected]> * chore(release): 1.69.0 [skip ci]nn * Revert "feat: TT-577 get profile pic from Google account (#825)" (#829) This reverts commit 3bee7e3. Co-authored-by: Carlos Carvajal <[email protected]> * chore(release): 1.69.1 [skip ci]nn * style: TT-579 Buttons and searchbar adjusted to the app style (#827) * fix: TT-590 unable to pass ci test (#831) * chore(release): 1.69.2 [skip ci]nn * Tt 582 improve the summary section of the time clock page QA (#830) * style: TT-582 improve the summary section with a new row with information of actual clock in register and clock out button * fix: TT-582 add missing unit test to confirm that clockout function in TimeEntriesSummaryComponent emits an event * style: TT-582 add a border radius to current elapsed time box * style: TT-582 improved the clocked in hour text and current time box * style: TT-582 improved the clocked in hour text and current time box * style: TT-582 removed whitespace Co-authored-by: Luis Moyón <[email protected]> * fix: TT-509 pr comments * fix: TT-509 using remote state to load variables * Update variables.tf * delete prefix docker * delete prefix docker in locals block * fix: Update the values of the terraform state output Co-authored-by: alejandra-ponce <[email protected]> Co-authored-by: Luis Moyon <[email protected]> Co-authored-by: semantic-release-bot <[email protected]> Co-authored-by: Fausto Castaneda <[email protected]> Co-authored-by: iHackN3WTON <[email protected]> Co-authored-by: LuisMS7 <[email protected]> Co-authored-by: David Cadena <[email protected]> Co-authored-by: Kevin Joseph Duy Hurtado <[email protected]> Co-authored-by: alejandra-ponce <[email protected]> Co-authored-by: Carlos Carvajal <[email protected]> Co-authored-by: MarcoAguirre <[email protected]> Co-authored-by: FreddyJR1995 <[email protected]>
1 parent 82e6dea commit 75e909a

File tree

8 files changed

+32712
-156
lines changed

8 files changed

+32712
-156
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ Thumbs.db
5555

5656
#ENV VARIABLES
5757
.env
58+
59+
# Terraform files
60+
**/.terraform**

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \
3737
chown -R ${USERNAME}:${USERNAME} /etc/nginx/conf.d
3838
RUN touch /var/run/nginx.pid && chown -R ${USERNAME}:${USERNAME} /var/run/nginx.pid
3939

40-
USER ${USERNAME}
41-
42-
EXPOSE 4200
40+
# FIXME: Actually if we can deploy to azure in port 80 we need a root user
41+
# Maybe we can refactor this dockerfile to use root user directly this is not a good approach y
42+
# security terms. It's a good practice to have rootless in containers so for this
43+
# we can to refactor this dockerfile and the terraform module to deploy in other ports because
44+
# Ports below 1024 needs root permisions.
45+
46+
# USER ${USERNAME}
47+
48+
EXPOSE 80

infrastructure/main.tf

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
terraform {
2+
required_version = "~> 1.1.2"
3+
required_providers {
4+
azurerm = {
5+
source = "hashicorp/azurerm"
6+
version = "~> 2.90"
7+
}
8+
}
9+
10+
backend "azurerm" {
11+
resource_group_name = "ioet-infra-tf-state"
12+
storage_account_name = "timetrackertfstate"
13+
container_name = "time-tracker-tf-state"
14+
key = "time-tracker-ui.tfstate"
15+
}
16+
17+
}
18+
19+
provider "azurerm" {
20+
features {}
21+
skip_provider_registration = true
22+
}
23+
24+
data "terraform_remote_state" "service" {
25+
backend = "azurerm"
26+
workspace = terraform.workspace
27+
config = {
28+
resource_group_name = "ioet-infra-tf-state"
29+
storage_account_name = "timetrackertfstate"
30+
container_name = "time-tracker-tf-state"
31+
key = "this.tfstate"
32+
}
33+
}
34+
35+
locals {
36+
common_name = "time-tracker-ui"
37+
environment = terraform.workspace
38+
service_name = "${local.common_name}-${local.environment}"
39+
create_app_service_plan = true
40+
service_plan_kind = "Linux"
41+
image_name = "timetracker_ui"
42+
}
43+
44+
module "ui" {
45+
source = "[email protected]:ioet/infra-terraform-modules.git//azure-app-service?ref=tags/v0.0.5"
46+
app_service_name = local.service_name
47+
create_app_service_plan = local.create_app_service_plan
48+
docker_image_name = "${local.image_name}:${var.image_tag}"
49+
docker_image_namespace = data.terraform_remote_state.service.outputs.container_registry_login_server
50+
docker_registry_password = data.terraform_remote_state.service.outputs.container_registry_admin_password
51+
docker_registry_url = data.terraform_remote_state.service.outputs.container_registry_login_server
52+
docker_registry_username = data.terraform_remote_state.service.outputs.container_registry_admin_username
53+
location = data.terraform_remote_state.service.outputs.container_registry_location
54+
resource_group_name = data.terraform_remote_state.service.outputs.resource_group_name
55+
service_plan_kind = local.service_plan_kind
56+
service_plan_name = local.service_name
57+
service_plan_size = var.service_plan_size
58+
service_plan_tier = var.service_plan_tier
59+
}

infrastructure/prod.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
service_plan_size = "S1"
2+
service_plan_tier = "Standard"

infrastructure/stage.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
service_plan_size = "S1"
2+
service_plan_tier = "Standard"

infrastructure/variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
variable "image_tag" {
2+
type = string
3+
description = "Specifies the docker image tag that is stored in a private container registry like ACR (Azure Container Registry)."
4+
sensitive = true
5+
}
6+
7+
variable "service_plan_size" {
8+
default = "S1"
9+
type = string
10+
description = "Specifies the size of the service plan. This variable format is: Tier (letter) + Size (number). Size could be: 1 = Small (1 Core 1.75GB RAM), 2 = Medium (2 Core 3.5 GB RAM), 3 = Large (4 Core 7GB RAM)"
11+
}
12+
13+
variable "service_plan_tier" {
14+
default = "Standard"
15+
type = string
16+
description = "Specifies the tier of the service plan. Tier is the pricing plan of the service plan resource."
17+
}

nginx.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server {
2-
listen 4200;
2+
listen 80;
33

44
root /usr/share/nginx/html;
55
index index.html;
@@ -9,4 +9,4 @@ server {
99
location / {
1010
try_files $uri /index.html;
1111
}
12-
}
12+
}

0 commit comments

Comments
 (0)