Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
chore: using ecs
Browse files Browse the repository at this point in the history
  • Loading branch information
charlee-dev committed Jun 30, 2024
1 parent 7478d37 commit 685ee5f
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 481 deletions.
50 changes: 28 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
ECR_CLUSTER: ${{ secrets.ECR_CLUSTER }}
ECR_SERVICE: ${{ secrets.ECR_SERVICE }}

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false

# - name: Set up JDK 17
# uses: actions/setup-java@v2
# with:
# java-version: '17'
# distribution: 'adopt'
#
# - name: Build with Gradle
# run: ./gradlew build
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'

- name: Build with Gradle
run: ./gradlew build

- name: Configure AWS credentials
id: aws-credentials
Expand All @@ -42,23 +45,26 @@ jobs:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
RUNNER_ROLE: ${{ secrets.RUNNER_ROLE }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Deploy to App Runner Image
id: deploy-apprunner
uses: awslabs/amazon-app-runner-deploy@main
with:
service: app-runner-git-deploy-service
image: ${{ steps.build-image.outputs.image }}
access-role-arn: ${{ secrets.ROLE_ARN }}
region: ${{ secrets.AWS_REGION }}
cpu: 1
memory: 2
wait-for-service-stability-seconds: 1200
# - name: Deploy to App Runner Image
# id: deploy-apprunner
# uses: awslabs/amazon-app-runner-deploy@main
# with:
# service: app-runner-git-deploy-service
# image: ${{ steps.build-image.outputs.image }}
# access-role-arn: ${{ secrets.ROLE_ARN }}
# region: ${{ secrets.AWS_REGION }}
# cpu: 1
# memory: 2
# wait-for-service-stability-seconds: 1200
#
# - name: App Runner URL
# run: echo "App runner URL ${{ steps.deploy-apprunner.outputs.service-url }}"

- name: App Runner URL
run: echo "App runner URL ${{ steps.deploy-apprunner.outputs.service-url }}"
- name: Update image in AWS
run: |
aws ecs update-service --cluster $ECR_CLUSTER --service $ECR_SERVICE --force-new-deployment

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions apps/shop/web/.kobweb/server/logs/kobweb-server.log
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
2024-06-30 17:19:21.653 [main] DEBUG ktor.application - Java Home: /Users/adrianwitaszak/.sdkman/candidates/java
2024-06-30 17:19:21.654 [main] DEBUG ktor.application - Class Loader: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579: [file:/Users/adrianwitaszak/CharLEEX/BeNatty/kotlin/BeNatty-Client/apps/shop/web/.kobweb/server/server.jar!/ch]
2024-06-30 17:19:21.664 [main] INFO ktor.application - No API jar file specified in conf.yaml. Server API routes will not be available.
2024-06-30 17:19:21.693 [main] INFO ktor.application - Application started in 0.073 seconds.
2024-06-30 17:19:21.771 [main] INFO ktor.application - Responding at http://0.0.0.0:8080
2024-06-30 17:19:28.813 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 17:19:30.053 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 17:19:32.198 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 17:19:33.491 [eventLoopGroupProxy-4-4] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 17:19:34.632 [eventLoopGroupProxy-4-4] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 17:19:41.630 [eventLoopGroupProxy-4-4] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 20:17:14.964 [main] DEBUG ktor.application - Java Home: /Users/adrianwitaszak/.sdkman/candidates/java
2024-06-30 20:17:14.965 [main] DEBUG ktor.application - Class Loader: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579: [file:/Users/adrianwitaszak/CharLEEX/BeNatty/kotlin/BeNatty-Client/apps/shop/web/.kobweb/server/server.jar!/ch]
2024-06-30 20:17:14.977 [main] INFO ktor.application - No API jar file specified in conf.yaml. Server API routes will not be available.
2024-06-30 20:17:15.011 [main] INFO ktor.application - Application started in 0.083 seconds.
2024-06-30 20:17:15.095 [main] INFO ktor.application - Responding at http://0.0.0.0:8081
2024-06-30 20:18:40.739 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 20:18:41.884 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 20:26:11.398 [eventLoopGroupProxy-4-5] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 20:26:11.811 [eventLoopGroupProxy-4-1] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 20:26:12.458 [eventLoopGroupProxy-4-5] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 20:26:12.721 [eventLoopGroupProxy-4-8] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 20:26:13.089 [eventLoopGroupProxy-4-5] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 20:26:13.671 [eventLoopGroupProxy-4-8] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 20:28:28.745 [eventLoopGroupProxy-4-9] DEBUG ktor.application - Served fallback index.html file in response to "/"
2024-06-30 20:28:29.186 [eventLoopGroupProxy-4-8] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 20:28:29.777 [eventLoopGroupProxy-4-9] DEBUG ktor.application - Client connected and is requesting kobweb status events.
2024-06-30 20:36:07.101 [eventLoopGroupProxy-4-9] DEBUG ktor.application - Stopped sending kobweb status events, probably because client disconnected or server is shutting down. (ChannelWriteException: Cannot write to a channel)
2024-06-30 20:36:16.646 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Kobweb server shutting down...
2024-06-30 20:36:17.706 [kotlinx.coroutines.DefaultExecutor] INFO ktor.application - Server finished shutting down.
3 changes: 0 additions & 3 deletions apps/shop/web/.kobweb/server/state.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package pages.home
package web.components.sections

import androidx.compose.runtime.Composable
import com.varabyte.kobweb.compose.foundation.layout.Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.varabyte.kobweb.compose.css.Cursor
import com.varabyte.kobweb.compose.css.ObjectFit
import com.varabyte.kobweb.compose.css.Overflow
import com.varabyte.kobweb.compose.css.UserSelect
import com.varabyte.kobweb.compose.foundation.layout.Box
Expand All @@ -23,6 +24,7 @@ import com.varabyte.kobweb.compose.ui.modifiers.gap
import com.varabyte.kobweb.compose.ui.modifiers.height
import com.varabyte.kobweb.compose.ui.modifiers.margin
import com.varabyte.kobweb.compose.ui.modifiers.maxWidth
import com.varabyte.kobweb.compose.ui.modifiers.objectFit
import com.varabyte.kobweb.compose.ui.modifiers.onClick
import com.varabyte.kobweb.compose.ui.modifiers.onFocusIn
import com.varabyte.kobweb.compose.ui.modifiers.onMouseOver
Expand Down Expand Up @@ -217,6 +219,7 @@ fun ScrollableItem(
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1 / 2)
.objectFit(ObjectFit.Cover)
)
SpanText(text = title)
SpanText(text = price)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package web.pages.home

import androidx.compose.runtime.Composable
import com.varabyte.kobweb.compose.css.ObjectFit
import com.varabyte.kobweb.compose.foundation.layout.Box
import com.varabyte.kobweb.compose.foundation.layout.Row
import com.varabyte.kobweb.compose.ui.Alignment
Expand All @@ -10,6 +11,7 @@ import com.varabyte.kobweb.compose.ui.modifiers.fillMaxSize
import com.varabyte.kobweb.compose.ui.modifiers.fillMaxWidth
import com.varabyte.kobweb.compose.ui.modifiers.height
import com.varabyte.kobweb.compose.ui.modifiers.maxWidth
import com.varabyte.kobweb.compose.ui.modifiers.objectFit
import com.varabyte.kobweb.compose.ui.modifiers.padding
import com.varabyte.kobweb.compose.ui.modifiers.position
import com.varabyte.kobweb.compose.ui.modifiers.top
Expand Down Expand Up @@ -48,7 +50,9 @@ fun CategoriesSection(
) {
Image(
src = item.url,
modifier = Modifier.fillMaxSize()
modifier = Modifier
.fillMaxSize()
.objectFit(ObjectFit.Cover)
)
Box(
contentAlignment = Alignment.Center,
Expand Down
4 changes: 2 additions & 2 deletions apps/shop/web/src/jsMain/kotlin/web/pages/home/Featured.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import web.components.widgets.ScrollableItem
@Composable
fun Featured(vm: HomeViewModel, state: HomeContract.State) {
HorizontalScrollSection(
title = getString(Strings.Featured).uppercase(),
title = state.featured.title.uppercase(),
seeMoreTitle = getString(Strings.SeeMoreFeatured),
items = state.featured.map { item ->
items = state.featured.items.map { item ->
ScrollableItem(
id = item.id,
urls = item.urls,
Expand Down
128 changes: 38 additions & 90 deletions apps/shop/web/src/jsMain/kotlin/web/pages/home/FromTheBlog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package web.pages.home

import androidx.compose.runtime.Composable
import com.varabyte.kobweb.compose.css.FontWeight
import com.varabyte.kobweb.compose.foundation.layout.Box
import com.varabyte.kobweb.compose.foundation.layout.Column
import com.varabyte.kobweb.compose.foundation.layout.Row
import com.varabyte.kobweb.compose.ui.Alignment
Expand All @@ -14,13 +13,10 @@ import com.varabyte.kobweb.compose.ui.modifiers.gap
import com.varabyte.kobweb.compose.ui.modifiers.margin
import com.varabyte.kobweb.compose.ui.modifiers.maxWidth
import com.varabyte.kobweb.compose.ui.modifiers.padding
import com.varabyte.kobweb.compose.ui.modifiers.size
import com.varabyte.kobweb.compose.ui.modifiers.translateX
import com.varabyte.kobweb.silk.components.graphics.Image
import com.varabyte.kobweb.silk.components.style.toModifier
import com.varabyte.kobweb.silk.components.text.SpanText
import component.localization.Strings
import component.localization.getString
import feature.shop.home.HomeContract
import feature.shop.home.HomeViewModel
import org.jetbrains.compose.web.css.em
Expand All @@ -34,7 +30,7 @@ import web.components.layouts.oneLayoutMaxWidth
import web.components.widgets.AppTextButton

@Composable
fun FromTheBlog(viewModel: HomeViewModel, state: HomeContract.State) {
fun FromTheBlog(vm: HomeViewModel, state: HomeContract.State) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
Expand All @@ -43,103 +39,55 @@ fun FromTheBlog(viewModel: HomeViewModel, state: HomeContract.State) {
.margin(top = 2.em)
) {
SpanText(
text = getString(Strings.FromTheBlog).uppercase(),
text = state.fromTheBlog.title.uppercase(),
modifier = HeadlineStyle.toModifier(H2Variant)
.padding(topBottom = 1.5.em)
)
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.maxWidth(oneLayoutMaxWidth)
) {
Image(
src = "https://icon-shopify-theme.myshopify.com/cdn/shop/articles/blog-two.jpg?v=1562342340&width=800",
alt = "",
state.fromTheBlog.items.forEach { item ->
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth(60.percent)
)
Column(
modifier = Modifier
.padding(2.5.em)
.gap(1.em)
.backgroundColor(AppColors.lightBg)
.translateX((-80).px)
.fillMaxWidth()
.maxWidth(oneLayoutMaxWidth)
) {
SpanText(
text = "Color pop",
modifier = HeadlineStyle.toModifier(H2Variant)
.fontWeight(FontWeight.SemiBold)
)
SpanText(
text = "As much as we live and breath monochrome styles (and we can all agree a majority of our " +
"daily wear is crisp whites and deep blacks), a gals gotta have a...",
Image(
src = item.url,
alt = item.title,
modifier = Modifier.fillMaxWidth(60.percent)
)
SpanText(
text = "Posted on Apr 28, 2024",
modifier = SubtitleStyle.toModifier()
)
Row(
modifier = Modifier.gap(0.5.em)
Column(
modifier = Modifier
.padding(2.5.em)
.gap(1.em)
.backgroundColor(AppColors.lightBg)
.translateX((-80).px)
) {
AppTextButton(
onClick = {},
content = { SpanText("Clothing") },
)
AppTextButton(
onClick = {},
content = { SpanText("Fashion") },
SpanText(
text = item.title,
modifier = HeadlineStyle.toModifier(H2Variant)
.fontWeight(FontWeight.SemiBold)
)
}
}
}
Box(Modifier.size(4.em))
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.maxWidth(oneLayoutMaxWidth)
) {
Column(
modifier = Modifier
.padding(2.5.em)
.gap(1.em)
.backgroundColor(AppColors.lightBg)
.translateX(40.px)
) {
SpanText(
text = "Summer look book",
modifier = HeadlineStyle.toModifier(H2Variant)
.fontWeight(FontWeight.SemiBold)
)
SpanText(
text = "Take a look at our favorite pieces from the latest summer collection in our hand- picked " +
"summer look book. Our inspiration for each piece was light, fun and an essential piece of every...",
)
SpanText(
text = "Posted on Mar 06, 2024",
modifier = SubtitleStyle.toModifier()
)
Row(
modifier = Modifier.gap(0.5.em)
) {
AppTextButton(
onClick = {},
content = { SpanText("Clothing") },
SpanText(
text = item.description,
)
AppTextButton(
onClick = {},
content = { SpanText("Fashion") },
SpanText(
text = item.date,
modifier = SubtitleStyle.toModifier()
)
Row(
modifier = Modifier.gap(0.5.em)
) {
item.links.forEach { link ->
AppTextButton(
onClick = {
// link.url
},
content = { SpanText(link.title) },
)
}
}
}
}
Image(
src = "https://icon-shopify-theme.myshopify.com/cdn/shop/articles/blog-one.jpg?v=1562342357&width=800",
alt = "",
modifier = Modifier
.fillMaxWidth(60.percent)
)
Box(Modifier.size(4.em))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import feature.shop.home.HomeContract
import feature.shop.home.HomeRoutes
import feature.shop.home.HomeViewModel
import feature.shop.navbar.DesktopNavRoutes
import pages.home.FreeSection
import web.components.layouts.GlobalVMs
import web.components.layouts.MainRoutes
import web.components.layouts.ShopMainLayout
import web.components.sections.FreeSection
import web.components.widgets.AppDividerHorizontal

@Composable
Expand Down
4 changes: 2 additions & 2 deletions apps/shop/web/src/jsMain/kotlin/web/pages/home/JustArrived.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import web.components.widgets.ScrollableItem
@Composable
fun JustArrived(vm: HomeViewModel, state: HomeContract.State) {
HorizontalScrollSection(
title = getString(Strings.JustArrived).uppercase(),
title = state.justArrived.title.uppercase(),
seeMoreTitle = getString(Strings.SeeMoreNewArrivals),
items = state.justArrived.map { item ->
items = state.justArrived.items.map { item ->
ScrollableItem(
id = item.id,
urls = item.urls,
Expand Down
6 changes: 3 additions & 3 deletions apps/shop/web/src/jsMain/kotlin/web/pages/home/LatestLooks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ fun LatestLooks(vm: HomeViewModel, state: HomeContract.State) {
.backgroundColor(ColorMode.current.toPalette().background)
) {
SpanText(
text = getString(Strings.TheLatestLooks).uppercase(),
text = state.latestLooksCategories.title.uppercase(),
modifier = HeadlineStyle.toModifier(H2Variant)
)
SpanText(getString(Strings.LatestLooksDescription1))
Row {
SpanText("${getString(Strings.Shop)}: ")
state.latestLooksCategories.forEachIndexed { index, item ->
val isLast = index == state.latestLooksCategories.size - 1
state.latestLooksCategories.items.forEachIndexed { index, item ->
val isLast = index == state.latestLooksCategories.items.size - 1

if (index > 0 && !isLast) {
SpanText(", ")
Expand Down
Loading

0 comments on commit 685ee5f

Please sign in to comment.