-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from just-pthai-it/development
refactor project's structure
- Loading branch information
Showing
65 changed files
with
634 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Set the root directory where the services are located | ||
SERVICES_DIR="./services" | ||
|
||
# Initialize an empty matrix array | ||
MATRIX="[" | ||
|
||
# Loop through each subfolder in the 'services' directory | ||
for SERVICE in $(ls -d ${SERVICES_DIR}/*/); do | ||
# Extract the folder name without the path | ||
SERVICE_NAME=$(basename $SERVICE) | ||
|
||
# Append to the matrix JSON object | ||
MATRIX+="{\"service-name\": \"$SERVICE_NAME\"}," | ||
done | ||
|
||
# Remove the last comma and close the JSON array | ||
MATRIX=${MATRIX%,} | ||
MATRIX+="]" | ||
|
||
# Output the matrix in the format that GitHub Actions expects using Environment Files | ||
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,8 @@ go.work.sum | |
|
||
#ide/editor | ||
#ide | ||
.idea | ||
.idea/* | ||
!.idea/runConfigurations | ||
.vscode | ||
|
||
.env* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Debug remote" type="GoRemoteDebugConfigurationType" factoryName="Go Remote" port="40000"> | ||
<option name="disconnectOption" value="ASK" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="build image-dev" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> | ||
<deployment type="dockerfile"> | ||
<settings> | ||
<option name="imageTag" value="utconnect-docs:dev-v1" /> | ||
<option name="buildArgs"> | ||
<list> | ||
<DockerEnvVarImpl> | ||
<option name="name" value="service_name" /> | ||
<option name="value" value="docs" /> | ||
</DockerEnvVarImpl> | ||
</list> | ||
</option> | ||
<option name="buildCliOptions" value="--progress=plain" /> | ||
<option name="buildOnly" value="true" /> | ||
<option name="sourceFilePath" value="Dockerfile-development" /> | ||
</settings> | ||
</deployment> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
25 changes: 25 additions & 0 deletions
25
...ose-local-single-service.yaml[adminer, app-service, postgres]_ Compose Deployment.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="compose-local-single-service.yaml[adminer, app-service, postgres]: Compose Deployment" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker"> | ||
<deployment type="docker-compose.yml"> | ||
<settings> | ||
<option name="composeProjectName" value="utconnect-go_single-local" /> | ||
<option name="envFilePath" value="" /> | ||
<option name="commandLineOptions" value="--build" /> | ||
<option name="services"> | ||
<list> | ||
<option value="adminer" /> | ||
<option value="app-service" /> | ||
<option value="postgres" /> | ||
</list> | ||
</option> | ||
<option name="sourceFilePath" value="../UTCTSS-microservices/compose-local-single-service.yaml" /> | ||
<option name="upDetach" value="false" /> | ||
<option name="upRemoveOrphans" value="true" /> | ||
<option name="upRenewAnonVolumes" value="true" /> | ||
</settings> | ||
</deployment> | ||
<method v="2"> | ||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="utconnect common setup" run_configuration_type="ShConfigurationType" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="utconnect common setup" type="ShConfigurationType"> | ||
<option name="SCRIPT_TEXT" value="" /> | ||
<option name="INDEPENDENT_SCRIPT_PATH" value="false" /> | ||
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/../../../projects/utconnect/utconnect-common-setup/create_network.sh" /> | ||
<option name="SCRIPT_OPTIONS" value="" /> | ||
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" /> | ||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/../../../projects/utconnect/utconnect-common-setup" /> | ||
<option name="INDEPENDENT_INTERPRETER_PATH" value="false" /> | ||
<option name="INTERPRETER_PATH" value="C:/Program Files/Git/git-bash.exe" /> | ||
<option name="INTERPRETER_OPTIONS" value="" /> | ||
<option name="EXECUTE_IN_TERMINAL" value="true" /> | ||
<option name="EXECUTE_SCRIPT_FILE" value="true" /> | ||
<envs /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM golang:1.22-alpine3.20 | ||
|
||
ARG service_name | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
RUN go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./build/migrationtool ./database/migrations/tool/. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./build/main ./app/. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./core/database/migrations/tool/bin/migration-tool ./core/database/migrations/tool/main/. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./bin/$service_name ./services/$service_name/app/. | ||
|
||
#RUN addgroup -g 1000 appgroup | ||
#RUN adduser -D -u 1000 appuser -G appgroup | ||
#USER appuser | ||
|
||
ENTRYPOINT ["./build/main"] | ||
ENV SERVICE_NAME=$service_name | ||
|
||
ENTRYPOINT ["sh", "-c", "./bin/$SERVICE_NAME"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM golang:1.22-alpine3.20 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
RUN go install github.com/air-verse/[email protected] | ||
RUN go install github.com/go-delve/delve/cmd/[email protected] | ||
RUN go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./build/migrationtool ./database/migrations/tool/. | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./core/database/migrations/tool/bin/migration-tool ./core/database/migrations/tool/main/. | ||
|
||
CMD ["air", "-d"] |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.