Compare commits

...

5 Commits

Author SHA1 Message Date
TakahashiNguyen e07ee318a7 fix: connect gateway to customer service (#26)
Release package / release (push) Successful in 9m5s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #26
2026-04-17 12:03:19 +00:00
gitea-actions d91b20357a chore: release [ci skip] 2026-04-17 06:14:34 +00:00
TakahashiNguyen f1ffc63a5f fix: better ci script (#25)
Release package / release (push) Successful in 15m33s
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #25
2026-04-17 05:59:35 +00:00
TakahashiNguyen a97e9ade6e fix: Resolve runtime issue with native build (#24)
Release package / release (push) Has been cancelled
Co-authored-by: TakahashiNg <83152264+TakahashiNguyen@users.noreply.github.com>
Reviewed-on: #24
2026-04-17 05:39:21 +00:00
gitea-actions 80ee08757d chore: release [ci skip] 2026-04-13 08:43:04 +00:00
23 changed files with 102 additions and 136 deletions
+17 -23
View File
@@ -1,36 +1,30 @@
FROM ubuntu:26.04
FROM jbangdev/jbang-action:latest AS jbang-provider
FROM node:current-trixie AS base
COPY --from=jbang-provider /jbang /jbang
ENV PATH="/jbang/bin:${PATH}"
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm install --global pnpm@latest
# Tránh các câu hỏi tương tác trong quá trình cài đặt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y ca-certificates && apt-get clean
RUN sed -i 's|http://archive.ubuntu.com|https://apt.demonkernel.io.vn|g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's|http://security.ubuntu.com|https://apt.demonkernel.io.vn|g' /etc/apt/sources.list.d/ubuntu.sources
# 1. Cài đặt các công cụ cơ bản
RUN apt-get update --fix-missing && apt-get install --no-install-recommends --no-install-suggests -y \
curl \
bash \
git \
docker-buildx \
docker-cli \
docker.io \
nodejs \
kubectl \
openjdk-25-jdk-headless \
maven
# 5. Cấu hình Git
RUN git config --global --add safe.directory '*'
# 2. Cài đặt Node.js & PNPM (thay thế cho apk pnpm)
RUN curl -fsSL https://get.pnpm.io/install.sh | bash -
# 3. Cài đặt Kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
&& install -m 0755 kubectl /usr/local/bin/kubectl
# 6. Cài đặt JBang & Quarkus CLI
ENV JBANG_DIR="/root/.jbang"
ENV PATH="${JBANG_DIR}/bin:${PATH}"
RUN curl -Ls https://sh.jbang.dev | bash -s - trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus@quarkusio
RUN jbang trust add https://repo1.maven.org/maven2/io/quarkus/quarkus-cli/
RUN jbang app install --fresh --force quarkus@quarkusio
+13 -6
View File
@@ -1,14 +1,19 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine
{
"dockerComposeFile": "docker-compose.main.yaml",
"build": {
"dockerfile": "Dockerfile",
"args": {
"http_proxy": "http://host.docker.internal:3142"
},
"options": ["--add-host=host.docker.internal:host-gateway"]
},
"runArgs": ["--add-host=host.docker.internal:host-gateway"],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=${localEnv:USERPROFILE}/.kube,target=/root/.kube,type=bind"
"source=${localEnv:USERPROFILE}/.kube,target=/root/.kube,type=bind",
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
"remoteUser": "root",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"customizations": {
"vscode": {
"extensions": [
@@ -24,7 +29,9 @@
},
"containerEnv": {
"TESTCONTAINERS_RYUK_DISABLED": "true",
"QUARKUS_DEBUG_HOST": "0.0.0.0"
"QUARKUS_DEBUG_HOST": "0.0.0.0",
"http_proxy": "http://host.docker.internal:3142"
},
"postCreateCommand": "git config --global --add safe.directory '*'",
"forwardPorts": [5005, 8080]
}
-29
View File
@@ -1,29 +0,0 @@
services:
kafka:
image: apache/kafka:latest
restart: unless-stopped
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
kafdrop:
image: obsidiandynamics/kafdrop:latest
restart: unless-stopped
depends_on:
- kafka
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
command: sh -c "sleep 5 && exec ./start-app"
environment:
KAFKA_BROKERCONNECT: "localhost:9092"
-14
View File
@@ -1,14 +0,0 @@
include:
- ./docker-compose.redis.yaml
services:
devcontainer:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
command: sleep infinity
@@ -1,13 +0,0 @@
services:
postgres:
image: postgres:alpine
environment:
- POSTGRES_PASSWORD=password
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
-11
View File
@@ -1,11 +0,0 @@
services:
redis:
image: redis:alpine
network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- redis_data:/data
volumes:
redis_data:
+11 -4
View File
@@ -11,9 +11,16 @@ jobs:
permissions:
contents: write
steps:
- uses: gerlero/apt-install@v1
with:
packages: openjdk-25-jdk-headless docker.io
- name: Install dependencies with Proxy
env:
http_proxy: "http://host.docker.internal:3142"
https_proxy: "http://host.docker.internal:3142"
run: |
# Kiểm tra proxy có hoạt động không
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests \
openjdk-25-jdk-headless docker-cli docker-buildx
- name: Setup SSH Key
run: |
@@ -39,7 +46,7 @@ jobs:
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.demonkernel.io.vn
registry: vps.demonkernel.io.vn
username: ${{ github.actor }}
password: ${{ secrets.ACCESS_TOKEN }}
+11 -4
View File
@@ -35,9 +35,16 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- uses: gerlero/apt-install@v1
with:
packages: openjdk-25-jdk-headless docker.io
- name: Install dependencies with Proxy
env:
http_proxy: "http://host.docker.internal:3142"
https_proxy: "http://host.docker.internal:3142"
run: |
# Kiểm tra proxy có hoạt động không
echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/80proxy
apt-get update
apt-get install -y --no-install-recommends --no-install-suggests \
openjdk-25-jdk-headless docker-cli docker-buildx
- name: Build and Test all modules
run: |
@@ -46,7 +53,7 @@ jobs:
- name: Publish Test Report
uses: dorny/test-reporter@v3
if: always()
if: always()
with:
name: "JUnit Tests Report"
path: "**/target/surefire-reports/*.xml"
+15
View File
@@ -1,3 +1,18 @@
## [1.5.3](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.2...v1.5.3) (2026-04-17)
### Bug Fixes
* better ci script ([#25](https://git.demonkernel.io.vn/FoodSurf/backend/issues/25)) ([f1ffc63](https://git.demonkernel.io.vn/FoodSurf/backend/commit/f1ffc63a5fe3f04b7de622f4df1406ddd977e8aa))
* Resolve runtime issue with native build ([#24](https://git.demonkernel.io.vn/FoodSurf/backend/issues/24)) ([a97e9ad](https://git.demonkernel.io.vn/FoodSurf/backend/commit/a97e9ade6e20458eb53bdb7ab9d083cef51408fc))
## [1.5.2](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.5.1...v1.5.2) (2026-04-13)
### Bug Fixes
* **semantic-release:** better config ([#22](https://git.demonkernel.io.vn/FoodSurf/backend/issues/22)) ([d925e0d](https://git.demonkernel.io.vn/FoodSurf/backend/commit/d925e0da2296c63384651dbe15316ad555b77bee))
# [1.5.0](https://git.demonkernel.io.vn/FoodSurf/backend/compare/v1.4.0...v1.5.0) (2026-04-12)
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -3,21 +3,21 @@ package com.drinkool.services;
import com.drinkool.InternalValue;
import com.drinkool.Url;
import com.drinkool.models.UserModel;
import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase;
import jakarta.transaction.Transactional;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.Response;
import java.util.UUID;
public abstract class BaseService {
public abstract class BaseService<T extends UserModel> {
private UserModel model;
private final PanacheRepositoryBase<T, UUID> repository;
public BaseService(UserModel model) {
this.model = model;
protected BaseService(Class<T> entityClass) {
this.repository = new PanacheRepositoryBase<T, UUID>() {};
}
@SuppressWarnings("static-access")
@POST
@GET
@Path(Url.Me)
@Transactional
public Response me(@HeaderParam(InternalValue.userId) UUID id) {
@@ -25,6 +25,6 @@ public abstract class BaseService {
.entity("InvalidUserId")
.build();
return Response.ok(model.find("id", id).firstResult()).build();
return Response.ok(repository.findById(id)).build();
}
}
@@ -9,13 +9,13 @@ import jakarta.ws.rs.*;
import jakarta.ws.rs.core.*;
@Path(Role.Customer)
public class CustomerService extends BaseService {
public class CustomerService extends BaseService<CustomerEntity> {
@Inject
OtpService otpService;
public CustomerService() {
super(new CustomerEntity());
super(CustomerEntity.class);
}
@POST
@@ -29,6 +29,7 @@ public class CustomerService extends BaseService {
return Response.status(Response.Status.CREATED)
.header(InternalValue.userId, newCustomer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(newCustomer)
.build();
}
@@ -43,6 +44,7 @@ public class CustomerService extends BaseService {
return Response.status(Response.Status.CREATED)
.header(InternalValue.userId, newCustomer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(newCustomer)
.build();
}
@@ -67,6 +69,7 @@ public class CustomerService extends BaseService {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(customer)
.build();
}
@@ -87,6 +90,7 @@ public class CustomerService extends BaseService {
return Response.accepted()
.header(InternalValue.userId, customer.id.toString())
.header(InternalValue.role, Role.Customer)
.entity(customer)
.build();
}
}
@@ -7,7 +7,7 @@ quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres
quarkus.hibernate-orm.database.generation=update
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=account-service
quarkus.container-image.push=true
@@ -27,4 +27,4 @@ quarkus.index-dependency.lib.artifact-id=lib
quarkus.native.container-build=true
quarkus.native.remote-container-build=true
quarkus.native.additional-build-args=--initialize-at-run-time=com.password4j.AlgorithmFinder,--future-defaults=all
quarkus.native.resources.includes=com/google/i18n/phonenumbers/data/.*
quarkus.native.resources.includes=com/google/i18n/phonenumbers/data/**/*
@@ -31,7 +31,7 @@ public class BaseServiceTest {
.header(InternalValue.userId, testUserId)
.contentType(ContentType.JSON)
.when()
.post(Role.Customer + Url.Me)
.get(Role.Customer + Url.Me)
.then()
.statusCode(200)
.body("id", is(testUserId));
@@ -39,6 +39,6 @@ public class BaseServiceTest {
@Test
public void testMeEndpointWithoutHeader() {
given().when().post(Role.Customer + Url.Me).then().statusCode(400);
given().when().get(Role.Customer + Url.Me).then().statusCode(400);
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -9,7 +9,7 @@ quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/eatery
quarkus.hibernate-orm.database.generation=update
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=eatery-service
quarkus.container-image.push=true
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -1,7 +1,9 @@
package com.drinkool;
package com.drinkool.controller;
import com.drinkool.Role;
import com.drinkool.Url;
import com.drinkool.dtos.*;
import com.drinkool.services.AccountService;
import com.drinkool.services.CustomerService;
import io.smallrye.mutiny.Uni;
import jakarta.inject.Inject;
import jakarta.ws.rs.*;
@@ -9,11 +11,11 @@ import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Path("/api/" + Role.Customer)
class CustomerGatewayResource {
public class CustomerController {
@Inject
@RestClient
AccountService accountService;
CustomerService accountService;
@POST
@Path(Url.Signup)
@@ -10,7 +10,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient(configKey = "account")
@Path(Role.Customer)
public interface AccountService {
public interface CustomerService {
@POST
@Path(Url.Signup)
Uni<Response> signup(Signup input);
@@ -27,10 +27,7 @@ public interface AccountService {
@Path(Url.QuickLogin)
Uni<Response> quickLogin(QuickSignup input);
@POST
@Path(Url.SmsOtp)
Uni<Response> smsOtp(SmsOtp input);
@GET
@Path(Url.Me)
Uni<Response> me();
}
@@ -1,5 +1,5 @@
# Docker
quarkus.container-image.registry=git.demonkernel.io.vn
quarkus.container-image.registry=vps.demonkernel.io.vn
quarkus.container-image.group=foodsurf
quarkus.container-image.name=gateway-service
quarkus.container-image.push=true
+3 -3
View File
@@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: account-pod
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.0
image: git.demonkernel.io.vn/foodsurf/account-service:1.5.3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
@@ -73,7 +73,7 @@ spec:
spec:
containers:
- name: eatery-pod
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.0
image: git.demonkernel.io.vn/foodsurf/eatery-service:1.5.3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
@@ -129,7 +129,7 @@ spec:
spec:
containers:
- name: gateway-pod
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.0
image: git.demonkernel.io.vn/foodsurf/gateway-service:1.5.3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
+1 -1
View File
@@ -9,7 +9,7 @@
<parent>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
+1 -1
View File
@@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.drinkool</groupId>
<artifactId>drinkool</artifactId>
<version>1.5.0</version>
<version>1.5.3</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>25</maven.compiler.source>