Skip to content

Commit a8df5c2

Browse files
Merge pull request #205 from selfdocumentingcode/refactor/project-structure
Refactor/project structure
2 parents 1ad277c + 248e98e commit a8df5c2

File tree

174 files changed

+110
-176
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+110
-176
lines changed

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
**/charts
1717
**/docker-compose*
1818
**/Dockerfile*
19+
**/*.Dockerfile*
1920
**/node_modules
2021
**/npm-debug.log
2122
**/obj
@@ -27,4 +28,7 @@ README.md
2728
!.git/HEAD
2829
!.git/config
2930
!.git/packed-refs
30-
!.git/refs/heads/**
31+
!.git/refs/heads/**
32+
**/*.local
33+
**/*.swp
34+
.secrets

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
packages: write
2626

2727
steps:
28-
- uses: actions/checkout@v3
28+
- uses: actions/checkout@v4
2929

3030
- name: Setup .NET Core
31-
uses: actions/setup-dotnet@v3
31+
uses: actions/setup-dotnet@v4
3232
with:
3333
dotnet-version: 8.0.x
3434

@@ -56,7 +56,7 @@ jobs:
5656
uses: docker/[email protected]
5757
with:
5858
context: .
59-
file: ./docker/Prod.Dockerfile
59+
file: ./src/Kattbot/prod.Dockerfile
6060
push: true
6161
tags: ${{ steps.meta.outputs.tags }}
6262
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release-v2.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ env:
1616
REGISTRY: ghcr.io
1717
IMAGE_NAME: kattbot
1818
COMPOSE_PROJECT_NAME: kattbot
19-
COMPOSE_FILE_NAME: prod-compose.yml
19+
COMPOSE_FILE_PATH_SRC: docker/docker-compose.prod.yml
20+
COMPOSE_FILE_NAME: docker-compose.prod.yml
2021
DB_NAME: kattbot
2122
DB_BACKUP_SCRIPT: kattbot-backup-db.sh
2223
DB_MIGRATION_SCRIPT: database_migration.sql
@@ -61,7 +62,7 @@ jobs:
6162
username: ${{secrets.KATTBOT_USER}}
6263
key: ${{secrets.KATTBOT_KEY}}
6364
passphrase: ${{secrets.KATTBOT_PASSPHRASE}}
64-
source: "docker/${{ env.COMPOSE_FILE_NAME }}"
65+
source: ${{ env.COMPOSE_FILE_PATH_SRC }}
6566
target: "$HOME/"
6667
strip_components: 1
6768
overwrite: true
@@ -84,13 +85,10 @@ jobs:
8485
script_stop: true
8586
script: |
8687
FULL_IMAGE_NAME="$REGISTRY/$REPOSITORY_NAME/$IMAGE_NAME:$IMAGE_TAG"
87-
FULL_IMAGE_NAME_PREVIOUS="$REGISTRY/$REPOSITORY_NAME/$IMAGE_NAME:$IMAGE_TAG-previous"
88+
echo "Full image name: $FULL_IMAGE_NAME"
8889
8990
MIGRATIONS_CONTAINER_NAME="$COMPOSE_PROJECT_NAME-migrations"
9091
91-
# Tag the previous image with the previous tag, if it exists
92-
docker image tag $FULL_IMAGE_NAME $FULL_IMAGE_NAME_PREVIOUS || true
93-
9492
# Pull the image from the registry
9593
echo $GHCR_PASSWORD | docker login $REGISTRY -u $GHCR_USERNAME --password-stdin
9694
docker pull $FULL_IMAGE_NAME
@@ -116,6 +114,9 @@ jobs:
116114
# Run the database migration script
117115
psql -d $DB_NAME -q -f "$TMP_MIGRATIONS_DIR/$DB_MIGRATION_SCRIPT"
118116
117+
# Remove the temporary directory
118+
rm -rf $TMP_MIGRATIONS_DIR
119+
119120
# Take down the old compose project, if it exists
120121
docker compose -p $COMPOSE_PROJECT_NAME down || true
121122
@@ -124,9 +125,6 @@ jobs:
124125
125126
# Prune untagged images
126127
docker image prune -f
127-
128-
# Remove the temporary directory
129-
rm -rf $TMP_MIGRATIONS_DIR
130128
envs: >-
131129
HOST_GATEWAY_IP,
132130
REGISTRY,

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,6 @@ ASALocalRun/
339339
# BeatPulse healthcheck temp database
340340
healthchecksdb
341341

342-
Kattbot.Data.Migrations/database_migration.sql
343-
344-
.env.local
342+
*.local
343+
*.swp
344+
.secrets

Kattbot.sln

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.3.32929.385
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot", "Kattbot\Kattbot.csproj", "{9EB340B8-8D7D-4BBA-A146-33F7A15B13CE}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot", "src\Kattbot\Kattbot.csproj", "{9EB340B8-8D7D-4BBA-A146-33F7A15B13CE}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Tests", "Kattbot.Tests\Kattbot.Tests.csproj", "{1C2153F7-4660-4021-9864-8F1F704054BF}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Tests", "tests\Kattbot.Tests\Kattbot.Tests.csproj", "{1C2153F7-4660-4021-9864-8F1F704054BF}"
99
EndProject
10-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D6F1BD9-5D5D-4C85-B254-B773679A5AF9}"
11-
ProjectSection(SolutionItems) = preProject
12-
.dockerignore = .dockerignore
13-
.editorconfig = .editorconfig
14-
.gitattributes = .gitattributes
15-
.gitignore = .gitignore
16-
Directory.Build.props = Directory.Build.props
17-
Dotnet_cheatsheet.md = Dotnet_cheatsheet.md
18-
Readme.md = Readme.md
19-
EndProjectSection
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Data", "src\Kattbot.Data\Kattbot.Data.csproj", "{F454BCE5-C964-4720-AD84-96A07FA7B8B1}"
2011
EndProject
21-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Data", "Kattbot.Data\Kattbot.Data.csproj", "{F454BCE5-C964-4720-AD84-96A07FA7B8B1}"
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Common", "src\Kattbot.Common\Kattbot.Common.csproj", "{FFC07C89-ECA8-4887-9376-DA43C5FC83AB}"
2213
EndProject
23-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Common", "Kattbot.Common\Kattbot.Common.csproj", "{FFC07C89-ECA8-4887-9376-DA43C5FC83AB}"
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Data.Migrations", "src\Kattbot.Data.Migrations\Kattbot.Data.Migrations.csproj", "{D26776E6-F360-425C-9281-F4E7B176197E}"
2415
EndProject
25-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kattbot.Data.Migrations", "Kattbot.Data.Migrations\Kattbot.Data.Migrations.csproj", "{D26776E6-F360-425C-9281-F4E7B176197E}"
16+
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker", "docker\docker.dcproj", "{642D827F-5BA9-4177-AE3D-4BAEE013BC3F}"
2617
EndProject
27-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{727EE4ED-CFEC-4BBC-B67A-3DA7F8EE3F1E}"
28-
ProjectSection(SolutionItems) = preProject
29-
scripts\kattbot-backup-db.sh = scripts\kattbot-backup-db.sh
30-
EndProjectSection
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E845ABD6-198E-45CF-92D5-97F1A5E741A3}"
3119
EndProject
32-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{524F91BA-735B-4F73-BEDD-A3CC1DEB452C}"
33-
ProjectSection(SolutionItems) = preProject
34-
.config\dotnet-tools.json = .config\dotnet-tools.json
35-
EndProjectSection
36-
EndProject
37-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{DC675219-AB3D-40B1-BA7C-27C5613023BC}"
38-
ProjectSection(SolutionItems) = preProject
39-
.github\workflows\build.yml = .github\workflows\build.yml
40-
.github\dependabot.yml = .github\dependabot.yml
41-
.github\workflows\release-v2.yml = .github\workflows\release-v2.yml
42-
.github\workflows\restart-v2.yml = .github\workflows\restart-v2.yml
43-
EndProjectSection
44-
EndProject
45-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docker", "docker", "{26E4A78E-3DA9-4825-896B-4A9B0B017188}"
46-
ProjectSection(SolutionItems) = preProject
47-
docker\docker-compose.yml = docker\docker-compose.yml
48-
docker\Dockerfile = docker\Dockerfile
49-
docker\prod-compose.yml = docker\prod-compose.yml
50-
docker\Prod.Dockerfile = docker\Prod.Dockerfile
51-
EndProjectSection
52-
EndProject
53-
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-vs", "docker-vs\docker-vs.dcproj", "{642D827F-5BA9-4177-AE3D-4BAEE013BC3F}"
20+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{17BE3AFF-E650-40BC-A5EF-DF77B794D988}"
5421
EndProject
5522
Global
5623
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -100,10 +67,11 @@ Global
10067
HideSolutionNode = FALSE
10168
EndGlobalSection
10269
GlobalSection(NestedProjects) = preSolution
103-
{727EE4ED-CFEC-4BBC-B67A-3DA7F8EE3F1E} = {2D6F1BD9-5D5D-4C85-B254-B773679A5AF9}
104-
{524F91BA-735B-4F73-BEDD-A3CC1DEB452C} = {2D6F1BD9-5D5D-4C85-B254-B773679A5AF9}
105-
{DC675219-AB3D-40B1-BA7C-27C5613023BC} = {2D6F1BD9-5D5D-4C85-B254-B773679A5AF9}
106-
{26E4A78E-3DA9-4825-896B-4A9B0B017188} = {2D6F1BD9-5D5D-4C85-B254-B773679A5AF9}
70+
{9EB340B8-8D7D-4BBA-A146-33F7A15B13CE} = {E845ABD6-198E-45CF-92D5-97F1A5E741A3}
71+
{FFC07C89-ECA8-4887-9376-DA43C5FC83AB} = {E845ABD6-198E-45CF-92D5-97F1A5E741A3}
72+
{F454BCE5-C964-4720-AD84-96A07FA7B8B1} = {E845ABD6-198E-45CF-92D5-97F1A5E741A3}
73+
{D26776E6-F360-425C-9281-F4E7B176197E} = {E845ABD6-198E-45CF-92D5-97F1A5E741A3}
74+
{1C2153F7-4660-4021-9864-8F1F704054BF} = {17BE3AFF-E650-40BC-A5EF-DF77B794D988}
10775
EndGlobalSection
10876
GlobalSection(ExtensibilityGlobals) = postSolution
10977
SolutionGuid = {49047B12-10BC-4E9D-9DA6-758947DF9CE8}

Kattbot/Dockerfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-vs/docker-compose.override.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

docker-vs/docker-compose.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

docker-vs/docker-vs.dcproj

Lines changed: 0 additions & 15 deletions
This file was deleted.

docker/Dockerfile

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)