Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
392 commits
Select commit Hold shift + click to select a range
699d992
update UserProfileRepository
Morphin20th Oct 7, 2025
ea54e92
create ProfileServiceInterface, define basic profiles routes
Morphin20th Oct 7, 2025
65ac5b3
add get & update profile endpoints
Morphin20th Oct 7, 2025
b2fcb5a
Merge pull request #21 from Morphin20th/feat/connect-snippets-api
mykhailokurochkin Oct 7, 2025
429e459
feat: implement basic add snippet page
mykhailokurochkin Oct 8, 2025
5496078
feat: implement basic ability to add and update snippets
mykhailokurochkin Oct 8, 2025
05ed59e
Merge branch 'develop' into feat/profile-api
Morphin20th Oct 8, 2025
e5f4676
update StorageInterface & DevStorage, remove mongo logs, update depen…
Morphin20th Oct 8, 2025
f4ad155
feat: improve add/edit snippets functionality
mykhailokurochkin Oct 8, 2025
af4aa76
feat avatar endpoints with DevStorage
Morphin20th Oct 8, 2025
b7453b6
refactor with ruff and pyright, remove mypy
Morphin20th Oct 8, 2025
4d039f3
feat: add description field
mykhailokurochkin Oct 8, 2025
708d546
feat: add redirect and notifications form create/edit snippet page
mykhailokurochkin Oct 9, 2025
b6e6dbe
Merge pull request #22 from Morphin20th/feat/profile-api
Morphin20th Oct 9, 2025
0cd1fc3
feat: add form fields validation
mykhailokurochkin Oct 9, 2025
2582e51
fix: add independence for the main heading
mykhailokurochkin Oct 9, 2025
40e003d
fix: improve form validation work
mykhailokurochkin Oct 9, 2025
4f9b427
feat: add save snippet button disabling if has invalid fields
mykhailokurochkin Oct 9, 2025
eb5b00f
add fields validation
Morphin20th Oct 9, 2025
22f7996
Merge branch 'feat/add/edit-snippets-page' of github.com:Morphin20th/…
Morphin20th Oct 9, 2025
6528b6a
Merge branch 'develop' into feat/add/edit-snippets-page
Morphin20th Oct 9, 2025
c19a780
Merge pull request #23 from Morphin20th/feat/add/edit-snippets-page
mykhailokurochkin Oct 9, 2025
a5bf357
add snippet creation with tags
Morphin20th Oct 9, 2025
2c6067a
feat tag update
Morphin20th Oct 9, 2025
37bdfe0
feat tag update
Morphin20th Oct 9, 2025
6ac3235
feat: add basic pagination structure
mykhailokurochkin Oct 9, 2025
2230eee
feat: connect pagination with api
mykhailokurochkin Oct 9, 2025
a4b17a1
feat: add pagination functionality with using search params
mykhailokurochkin Oct 10, 2025
0f35272
feat: add logic for big total_pages number rendering
mykhailokurochkin Oct 10, 2025
bada259
Merge pull request #24 from Morphin20th/feat/tag-api
Morphin20th Oct 10, 2025
1d60d51
fix: cancel pagination visibility if snippets are loading
mykhailokurochkin Oct 10, 2025
97b8629
feat: add search params changing on pagination page change
mykhailokurochkin Oct 10, 2025
dbb34cd
Merge pull request #25 from Morphin20th/feat/snippet-page-pagination
mykhailokurochkin Oct 10, 2025
995f4ff
feat: add basic tags logic
mykhailokurochkin Oct 10, 2025
d69e059
feat: add ability to add and remove snippet's tags
mykhailokurochkin Oct 10, 2025
ee43201
optimize n+1 with documents
Morphin20th Oct 10, 2025
27bd685
add tags & language filters
Morphin20th Oct 10, 2025
d2a2eea
feat: add validation for tags input
mykhailokurochkin Oct 10, 2025
1e8da0d
feat filter by date range
Morphin20th Oct 10, 2025
087771d
add filter by username
Morphin20th Oct 11, 2025
eebcac4
add validation
Morphin20th Oct 11, 2025
9d8a30b
update get snippets: user can see private obj, add visibility filter
Morphin20th Oct 11, 2025
20aa695
Merge pull request #26 from Morphin20th/feat/add-tags
mykhailokurochkin Oct 12, 2025
86a71db
feat: add snippet details page structure
mykhailokurochkin Oct 13, 2025
f143790
feat: add ability to copy snippet content by clicking on the button
mykhailokurochkin Oct 13, 2025
e0b9c12
feat: add edit button functional and ability to close notification
mykhailokurochkin Oct 13, 2025
972f472
Merge pull request #27 from Morphin20th/feat/filter-snippets
Morphin20th Oct 13, 2025
dc3f663
refactor: change sizes of buttons and improve snippet information blo…
mykhailokurochkin Oct 13, 2025
8eb2d57
Merge pull request #28 from Morphin20th/feat/snippet-details-page
mykhailokurochkin Oct 13, 2025
02d8b48
feat: add profile client
mykhailokurochkin Oct 13, 2025
7b4ea9e
feat: add profile data loading
mykhailokurochkin Oct 13, 2025
1c8da5e
feat: add basic filters structure
mykhailokurochkin Oct 13, 2025
73ef05a
refactor: improve accessability
mykhailokurochkin Oct 13, 2025
d8e903a
feat: add filtration using search params and fix tab accessability fo…
mykhailokurochkin Oct 13, 2025
f040d94
migrate to python3.13, update logger
Morphin20th Oct 13, 2025
1a241f8
add get specific user profile, username in GET /profile
Morphin20th Oct 13, 2025
9dc8dc6
add basic admin models
Morphin20th Oct 13, 2025
c4e0bad
feat: add ability to filter by tags using params and moved pagination…
mykhailokurochkin Oct 14, 2025
1e8a10d
feat: add all filters structure
mykhailokurochkin Oct 14, 2025
3627bba
feat: improve filters interface
mykhailokurochkin Oct 14, 2025
391fd29
feat: implement filtering snippets by tag
mykhailokurochkin Oct 14, 2025
32ba0be
fix: fix the issue with duplicate snippets
mykhailokurochkin Oct 14, 2025
c57b73d
feat: add ability to change snippets per page value and improve acces…
mykhailokurochkin Oct 14, 2025
8d4bd59
feat: add debounce for username filter field
mykhailokurochkin Oct 14, 2025
3e5a4c9
Merge pull request #29 from Morphin20th/feat/migrate-py-13/profile-up…
Morphin20th Oct 14, 2025
a6e509c
Merge pull request #30 from Morphin20th/feat/filter-snippets-tools
mykhailokurochkin Oct 15, 2025
ae7222c
fix: change set new password page logic
mykhailokurochkin Oct 15, 2025
9ac8b8b
feat: add basic user's info in profile page
mykhailokurochkin Oct 15, 2025
5e908ca
feat: add basic profile navigation structure
mykhailokurochkin Oct 15, 2025
6f5f5a4
feat: add profile navigation bar with active states
mykhailokurochkin Oct 15, 2025
eb2ea75
Merge branch 'develop' into feat/profile-page
mykhailokurochkin Oct 15, 2025
e2f4bee
feat: add profile snippets section with pagination
mykhailokurochkin Oct 16, 2025
eac91b4
feat: add profile settings structure
mykhailokurochkin Oct 16, 2025
5689814
feat: add routes for profile navigation
mykhailokurochkin Oct 16, 2025
70c1015
feat: add conditional profile interface
mykhailokurochkin Oct 16, 2025
4ea96c7
fix: change profile snippets loader position
mykhailokurochkin Oct 16, 2025
b9631cf
refactor: improve profile interface
mykhailokurochkin Oct 16, 2025
2f85011
Merge pull request #31 from Morphin20th/feat/profile-page
mykhailokurochkin Oct 16, 2025
58649aa
feat: implement favorites page using localStorage
mykhailokurochkin Oct 17, 2025
68ddca8
Merge pull request #32 from Morphin20th/feat/favorites-page
mykhailokurochkin Oct 17, 2025
ccd31d3
feat: add full profile edit form structure
mykhailokurochkin Oct 17, 2025
ce49255
Merge branch 'develop' into feat/admin-dashboard
Morphin20th Oct 17, 2025
f741b21
update migrations
Morphin20th Oct 18, 2025
345952f
feat: connect form to api
mykhailokurochkin Oct 18, 2025
30660a4
fix schema validation & lazy model loading
Morphin20th Oct 18, 2025
5db60f8
fix: add sending only changed fields
mykhailokurochkin Oct 18, 2025
0f25adc
feat: add redirection and toast messages for profile edit page
mykhailokurochkin Oct 18, 2025
4ee1091
feat: improve interface logic for profile edit mode
mykhailokurochkin Oct 18, 2025
d5e8c74
feat: add ability to change user gender information in profile
mykhailokurochkin Oct 18, 2025
9777b14
feat: remove ability to change profile visibility
mykhailokurochkin Oct 18, 2025
a897935
refactor: fix linter errors
mykhailokurochkin Oct 18, 2025
f3e1b28
Merge pull request #33 from Morphin20th/feat/profile-edit-page
mykhailokurochkin Oct 18, 2025
b620adf
feat: implement change password page
mykhailokurochkin Oct 19, 2025
79af55c
mount admin to an app
Morphin20th Oct 20, 2025
1370910
add auth provider
Morphin20th Oct 20, 2025
a2848cc
Merge pull request #34 from Morphin20th/feat/change-password-page
mykhailokurochkin Oct 20, 2025
6b4cf88
Merge pull request #35 from Morphin20th/feat/admin-dashboard
Morphin20th Oct 20, 2025
95c51b5
remove logic from main.py
Morphin20th Oct 21, 2025
1fd1369
add favorites endpoints structure
Morphin20th Oct 21, 2025
df27a1a
create FavoritesServiceInterface, update imports & filenames
Morphin20th Oct 21, 2025
b974cf5
create FavoritesRepository with add & remove methods, service update
Morphin20th Oct 21, 2025
2b7e43f
implement get favorites with filters & sortings, move pagination logi…
Morphin20th Oct 21, 2025
53196b5
add examples, update with REST principles
Morphin20th Oct 21, 2025
96b2183
refactor: restructure routes module
Morphin20th Oct 21, 2025
8508a99
refactor: restructure schemas module
Morphin20th Oct 21, 2025
0b49773
Merge pull request #36 from Morphin20th/feat/favorite-endpoints
Morphin20th Oct 22, 2025
015fed7
create SnippetSearchServiceInterface and schemas
Morphin20th Oct 22, 2025
1eb6300
implement basic search endpoint without cache
Morphin20th Oct 22, 2025
f663bb7
feat caching results
Morphin20th Oct 22, 2025
3b60edd
refactor: restructure dependencies module
Morphin20th Oct 22, 2025
fa34feb
add repositories dependencies, refactor all services to work with them
Morphin20th Oct 22, 2025
0a057db
refactor with lints
Morphin20th Oct 22, 2025
30bcb34
Merge pull request #37 from Morphin20th/feat/snippets-search
markkolomoyets Oct 24, 2025
063b40f
feat: connect favorites to server
mykhailokurochkin Oct 25, 2025
e094757
feat: add ability to add to favorites in snippet details page
mykhailokurochkin Oct 25, 2025
54e7245
add celery & delete tokens tasks
Morphin20th Oct 25, 2025
44a8453
Merge pull request #38 from Morphin20th/feat/connect-favorites-api
mykhailokurochkin Oct 25, 2025
72bb03a
add sync_db connection, restructure repositories module
Morphin20th Oct 25, 2025
5a3a438
add delete unused tags task
Morphin20th Oct 25, 2025
4521a26
update docker-compose with new worker services by docstring
Morphin20th Oct 25, 2025
49f72aa
Merge pull request #39 from Morphin20th/feat/worker
Morphin20th Oct 26, 2025
eeca037
add slowapi limiter to an app
Morphin20th Oct 26, 2025
654c146
add limits to accounts endpoints, key_func for authenticated user
Morphin20th Oct 26, 2025
6b0880a
add limits to snippets endpoints
Morphin20th Oct 26, 2025
e5853f5
update refresh_token to use in http-only
Morphin20th Oct 26, 2025
69f5812
Merge pull request #40 from Morphin20th/feat/throttling
Morphin20th Oct 27, 2025
60a38d6
add docker-compose.test.yml file, pytest configs in pyproject.toml, D…
Morphin20th Oct 28, 2025
c66b78f
add TestingSettings
Morphin20th Oct 28, 2025
4ea8f52
add user repository tests, UserFactory
Morphin20th Oct 28, 2025
4d2ac36
add token repo tests
Morphin20th Oct 28, 2025
5d218ba
feat jwt_manager tests
Morphin20th Oct 28, 2025
df0938a
feat auth service tests
Morphin20th Oct 28, 2025
7fa53bd
feat user service tests
Morphin20th Oct 29, 2025
0e3d0e6
Merge branch 'develop' into feat/auth-integration-tests
Morphin20th Oct 29, 2025
e3f124c
update README.md
Morphin20th Oct 29, 2025
92bc7dd
Merge branch 'feat/auth-integration-tests' of github.com:Morphin20th/…
Morphin20th Oct 29, 2025
6e33380
Merge pull request #41 from Morphin20th/feat/auth-integration-tests
markkolomoyets Oct 29, 2025
b9d086d
add email unit tests
Morphin20th Oct 29, 2025
60b9e27
refactor integration tests
Morphin20th Oct 29, 2025
aa4d04e
add register and activation tests
Morphin20th Oct 29, 2025
111a26c
add auth tests
Morphin20th Oct 29, 2025
bb03f34
update JWT manager and auth service, add password tests
Morphin20th Oct 30, 2025
965ab60
add flow tests
Morphin20th Oct 30, 2025
53aec13
Merge pull request #42 from Morphin20th/feat/auth-e2e-tests
Morphin20th Oct 30, 2025
6cfdab8
refactor token tests
Morphin20th Oct 30, 2025
2f4ec38
feat profile repo tests
Morphin20th Oct 30, 2025
f48fba7
feat dev storage tests, restructure fixtures
Morphin20th Oct 30, 2025
5bdc9fe
feat profile service tests
Morphin20th Oct 31, 2025
2e67e65
refactor with ruff
Morphin20th Oct 31, 2025
c5780f8
Merge pull request #43 from Morphin20th/feat/profile-integration-tests
Morphin20th Oct 31, 2025
016dbac
feat: implement default log in using cookies
mykhailokurochkin Nov 3, 2025
d6053a3
feat: implement log out ability and fixed notification render mismatch
mykhailokurochkin Nov 3, 2025
b33162c
feat: add google log in to authClient
mykhailokurochkin Nov 3, 2025
73802d9
update set_refresh_token logic
Morphin20th Nov 3, 2025
8912cf4
Merge pull request #44 from Morphin20th/feat/cookies-tokens-logic
mykhailokurochkin Nov 3, 2025
26f48af
feat: improve avatar icon and add button for change avatar
mykhailokurochkin Nov 3, 2025
7a84d6a
feat: add mutation for rerender avatar on change
mykhailokurochkin Nov 3, 2025
eafd6dc
feat: add notification if avatar file is to large
mykhailokurochkin Nov 3, 2025
a582a70
Merge pull request #45 from Morphin20th/feat/profile-avatar
mykhailokurochkin Nov 3, 2025
33b2da6
feat: add modal window with ability to log out from all sessions
mykhailokurochkin Nov 3, 2025
b111b09
Merge pull request #46 from Morphin20th/feat/all-sessions-logout
mykhailokurochkin Nov 4, 2025
a38b3e5
add raising 409 if snippet with this title & user_id exists
Morphin20th Nov 4, 2025
b8b109b
update migrations to use new Gender field, update error details
Morphin20th Nov 4, 2025
e9de86d
update routes user can't get private snippets of others
Morphin20th Nov 4, 2025
b95a894
feat: add search by title with results showing
mykhailokurochkin Nov 4, 2025
6292ef1
Merge pull request #47 from Morphin20th/fix/snippet-func
Morphin20th Nov 4, 2025
f285d8c
restructure config module, add Oracle Object Storage settings
Morphin20th Nov 4, 2025
0d9ef54
add ProdStorage
Morphin20th Nov 4, 2025
662a746
add .env.prod.sample
Morphin20th Nov 4, 2025
0ef3ba5
Merge pull request #48 from Morphin20th/feat/oos-storage
Morphin20th Nov 4, 2025
fce02b7
add profile routes' tests
Morphin20th Nov 5, 2025
b85bae3
add profile e2e tests
Morphin20th Nov 5, 2025
4163d70
Merge pull request #49 from Morphin20th/feat/profile-e2e-tests
Morphin20th Nov 5, 2025
7342471
feat: add snippet programming language to search results item
mykhailokurochkin Nov 6, 2025
e249794
feat: implement remove own snippet ability
mykhailokurochkin Nov 6, 2025
2a333b6
Merge pull request #51 from Morphin20th/feat/remove-snippet
Morphin20th Nov 6, 2025
d062b7e
fix: fixed snippet title broking if title is too long
mykhailokurochkin Nov 6, 2025
39773e8
feat: add modal window to confirm snippet delete
mykhailokurochkin Nov 6, 2025
e1bd18a
update snippet routes to return username, update migrations
Morphin20th Nov 6, 2025
34e5b7c
refactor with ruff
Morphin20th Nov 6, 2025
f25be05
Merge pull request #52 from Morphin20th/fix/snippet-details
Morphin20th Nov 6, 2025
ccc4c07
add SnippetDocumentRepository tests
Morphin20th Nov 6, 2025
3b6aab7
add SnippetRepository tests
Morphin20th Nov 6, 2025
7e2d37d
add SnippetService tests
Morphin20th Nov 7, 2025
dcf34e6
fix: changed redirection paths for snippet for SnippetFormPage
mykhailokurochkin Nov 8, 2025
147e22e
fix: changed redireciton path for already logged-in users
mykhailokurochkin Nov 8, 2025
666657b
refactor: add required text for required labels
mykhailokurochkin Nov 8, 2025
f19c358
fix: change tags allowed characters
mykhailokurochkin Nov 9, 2025
3dc62df
fix: add regex testing for sign up form password
mykhailokurochkin Nov 9, 2025
555b51f
fix: change list of allowed characters for password
mykhailokurochkin Nov 9, 2025
5fd957a
Merge pull request #54 from Morphin20th/feat/snippets-integration-tests
Morphin20th Nov 9, 2025
13e69df
update tags validation, rename snippet create endpoint
Morphin20th Nov 9, 2025
1b239bb
refactor: change path for create snippet method
mykhailokurochkin Nov 9, 2025
b9f7831
fix tag validation
Morphin20th Nov 9, 2025
0603283
add FavoritesRepo tests
Morphin20th Nov 12, 2025
0d2de18
refactor SnippetFactory, setup_snippets and all snippets tests
Morphin20th Nov 12, 2025
ce1fe27
add tests for Favorites and search services
Morphin20th Nov 12, 2025
baf5385
Merge pull request #58 from Morphin20th/fix/tags-allowed-characters
markkolomoyets Nov 13, 2025
e92e802
Merge pull request #56 from Morphin20th/fix/redirect-if-logged-in
markkolomoyets Nov 13, 2025
3b8788a
Merge pull request #57 from Morphin20th/refactor/add-required-marks
markkolomoyets Nov 13, 2025
77b341e
Merge pull request #60 from Morphin20th/feat/favorites-search-integra…
Morphin20th Nov 13, 2025
918be49
implement basic snippet routes e2e tests
Morphin20th Nov 13, 2025
0d2ea41
add flow tests
Morphin20th Nov 13, 2025
677ada2
Merge pull request #61 from Morphin20th/feat/snippets-e2e-tests
Morphin20th Nov 14, 2025
aa4b701
add favorites route tests
Morphin20th Nov 14, 2025
4bae78f
add search route tests
Morphin20th Nov 14, 2025
6ab923e
add flow tests
Morphin20th Nov 14, 2025
74e29d8
Merge pull request #62 from Morphin20th/feat/favorites-search-e2e-tests
markkolomoyets Nov 17, 2025
a1e90a5
implement only-admin acces to doc urls
Morphin20th Nov 22, 2025
d538cf5
fix: fix password regex and display server validation errors
mykhailokurochkin Nov 23, 2025
18f10d5
Merge branch 'develop' into fix/broken-snippet-text
mykhailokurochkin Nov 23, 2025
da48195
feat: add Azure infrastructure setup with Terraform and Docker support
ilya776 Nov 23, 2025
123916f
feat: add Azure infrastructure setup with Terraform and Docker support
ilya776 Nov 23, 2025
61f99e5
feat: update CI/CD configuration for improved testing and deployment …
ilya776 Nov 23, 2025
7dc5580
feat: update CI/CD configuration for improved testing and deployment …
ilya776 Nov 23, 2025
3cb2c53
feat: update CI/CD configuration for improved testing and deployment …
ilya776 Nov 23, 2025
ea5ae6e
feat: update CI/CD configuration for improved testing and deployment …
ilya776 Nov 23, 2025
c95f14c
feat: update CI/CD configuration for improved testing and deployment …
ilya776 Nov 23, 2025
899b5cf
feat: update health check command in CI/CD configuration for MongoDB
ilya776 Nov 23, 2025
7e18b65
feat: add support for in-memory SQLite database in CI/CD configuratio…
ilya776 Nov 23, 2025
2b81410
feat: remove MongoDB service from CI/CD configurations and simplify d…
ilya776 Nov 23, 2025
13a0193
feat: enhance CI/CD configurations by adding pytest execution and imp…
ilya776 Nov 23, 2025
925fd64
feat: remove pytest execution from CI/CD configurations for backend
ilya776 Nov 23, 2025
324b508
feat: remove smoke test steps from CI/CD configurations for developme…
ilya776 Nov 23, 2025
a2f61aa
feat: remove smoke test steps from CI/CD configurations for developme…
ilya776 Nov 23, 2025
1c0aef3
Merge pull request #53 from SnippetlyTeam/fix/broken-snippet-text
mykhailokurochkin Nov 24, 2025
9e4819b
fix: resolve Google OAuth URL issue and improve snippet details handling
mykhailokurochkin Nov 24, 2025
bfe5279
Merge pull request #65 from SnippetlyTeam/fix/sign-up-form-validation
mykhailokurochkin Nov 24, 2025
29b2a07
refactor: simplify google sign in process
mykhailokurochkin Nov 24, 2025
5f39453
feat: update CI/CD configurations for development and production envi…
ilya776 Nov 30, 2025
1f76273
fix: simplify docker-compose healthcheck conditions and dependencies
ilya776 Nov 30, 2025
9e24f1a
fix: ensure SERVER_BASE_URL defaults to an empty string in client files
ilya776 Nov 30, 2025
3ff66b4
Merge pull request #64 from SnippetlyTeam/feat/admin-access-docs
Morphin20th Dec 7, 2025
8b8e178
feat: implement production environment with HTTPS using Nginx and Let…
ilya776 Dec 8, 2025
01efef1
Merge branch 'develop' into fix/infrastructure
ilya776 Dec 8, 2025
7f2f7b4
fix: correct syntax error in SnippetDetailsPage component
ilya776 Dec 8, 2025
99fb353
Merge pull request #68 from SnippetlyTeam/fix/infrastructure
ilya776 Dec 8, 2025
227d15e
fix: correct syntax error in SnippetDetailsPage component
ilya776 Dec 8, 2025
3973545
refactor: update backup scripts and cloud-init to use dynamic project…
ilya776 Dec 8, 2025
65f28de
refactor: update paths in CI/CD and cloud-init scripts to use /opt/sn…
ilya776 Dec 8, 2025
2242cec
ruff requirements
Morphin20th Dec 10, 2025
998880c
include docs router in app
Morphin20th Dec 14, 2025
edcc5da
Merge pull request #70 from SnippetlyTeam/fix/docs-routes
Morphin20th Dec 14, 2025
690e07a
refactor: update paths in CI/CD and cloud-init scripts to use /opt/sn…
ilya776 Dec 14, 2025
c241a35
refactor: update paths in CI/CD and cloud-init scripts to use /opt/sn…
ilya776 Dec 14, 2025
bd869ec
refactor: update paths in CI/CD and cloud-init scripts to use /opt/sn…
ilya776 Dec 14, 2025
41e5f87
fix: critical errors founded by npm test
ilya776 Dec 14, 2025
6fcfed1
Merge branch 'develop' into fix/snippet-errors
Morphin20th Dec 14, 2025
862d306
Merge pull request #67 from SnippetlyTeam/fix/snippet-errors
Morphin20th Dec 14, 2025
f309e3b
fix: critical errors founded by npm test
ilya776 Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .deploy.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Deployment image references used by docker-compose on servers
# Provide full image references including registry and tag
BACKEND_IMAGE=
FRONTEND_IMAGE=
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# cache
__pycache__/
.mypy_cache
.ruff_cache
*.py[cod]
*.pyo
*.pyd
*.db

# Virtual environments
backend/.venv/
env/
venv/

# Editor & OS files
.idea/
.vscode/

# Logs
*.log

# Git
.git/
.gitignore

# Secrets & environment files
.env
.env.*
245 changes: 245 additions & 0 deletions .github/workflows/ci-cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
name: CI/CD Dev

on:
# Any PR to develop → tests + lint + type-check only (no deploy)
pull_request:
branches:
- develop
# Push to develop branch → CI + build + deploy to dev VM
push:
branches:
- develop

env:
BACKEND_IMAGE_NAME: snippetly-backend
FRONTEND_IMAGE_NAME: snippetly-frontend

jobs:
backend-tests:
name: Backend Tests + Ruff + Pyright (Dev)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies (tests + dev tooling)
working-directory: ./backend
run: |
uv sync --group test --group dev

- name: Ruff lint
working-directory: ./backend
run: |
uv run ruff check .

- name: Pyright type-check
working-directory: ./backend
run: |
uv run pyright

frontend-build:
name: Frontend Build (Dev)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./frontend/package-lock.json

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Build
working-directory: ./frontend
run: npm run build

- name: Run tests
working-directory: ./frontend
run: npm test

build-push-dev:
name: Build & Push Images (Dev)
runs-on: ubuntu-latest
# Only on push to develop branch (not on PRs)
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
needs: [ backend-tests, frontend-build ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker login to ACR (Dev, Service Principal)
run: |
echo "${{ secrets.DEV_AZURE_SP_PASSWORD }}" | docker login "${{ secrets.DEV_ACR_LOGIN_SERVER }}" \
-u "${{ secrets.DEV_AZURE_SP_APP_ID }}" \
--password-stdin

- name: Build & push backend
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
tags: ${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.BACKEND_IMAGE_NAME }}:${{ github.sha }}
cache-from: type=registry,ref=${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.BACKEND_IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.BACKEND_IMAGE_NAME }}:cache,mode=max

- name: Build & push frontend (Nginx)
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile
push: true
tags: ${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ github.sha }}
build-args: |
VITE_SERVER_BASE_URL=${{ secrets.DEV_PUBLIC_URL || format('http://{0}', secrets.DEV_SSH_HOST) }}
cache-from: type=registry,ref=${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.FRONTEND_IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.FRONTEND_IMAGE_NAME }}:cache,mode=max

deploy-dev:
name: Deploy to Azure VM (Dev)
runs-on: ubuntu-latest
# Only on push to develop branch (not on PRs)
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
needs: [ build-push-dev ]
environment: dev
concurrency:
group: cd-dev
cancel-in-progress: true
steps:
- name: Deploy over SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.DEV_SSH_HOST }}
username: ${{ secrets.DEV_SSH_USER }}
key: ${{ secrets.DEV_SSH_KEY }}
script_stop: true
script: |
set -euo pipefail
cd /opt/snippetly

# Rollback function
rollback() {
echo "❌ Deployment failed! Rolling back to previous version..."
if [ -f .deploy.env.bak ]; then
mv .deploy.env.bak .deploy.env
set -a
. ./.deploy.env
set +a
docker compose -f docker-compose.yml -f docker-compose.override.yml pull || true
docker compose -f docker-compose.yml -f docker-compose.override.yml up -d || true
echo "✅ Rollback completed"
else
echo "⚠️ No backup found, cannot rollback"
fi
exit 1
}

# Trap errors for rollback
trap 'rollback' ERR

# Pull latest code from develop branch
echo "Pulling latest code from develop branch..."
git fetch origin
git checkout develop
git pull origin develop

# Ensure .deploy.env exists
if [ ! -f .deploy.env ]; then
cat > .deploy.env << 'EOF'
BACKEND_IMAGE=
FRONTEND_IMAGE=
EOF
fi

# Compute image tags for this run (same as in build-push-dev)
BACKEND_IMAGE="${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.BACKEND_IMAGE_NAME }}:${{ github.sha }}"
FRONTEND_IMAGE="${{ secrets.DEV_ACR_LOGIN_SERVER }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ github.sha }}"

echo "Updating deployment configuration..."
# Update images in .deploy.env (creates .bak file automatically)
sed -i.bak \
-e "s|^BACKEND_IMAGE=.*$|BACKEND_IMAGE=${BACKEND_IMAGE}|" \
-e "s|^FRONTEND_IMAGE=.*$|FRONTEND_IMAGE=${FRONTEND_IMAGE}|" \
.deploy.env

# Load deployment environment
set -a
# shellcheck source=/dev/null
. ./.deploy.env
set +a

echo "Using BACKEND_IMAGE=$BACKEND_IMAGE"
echo "Using FRONTEND_IMAGE=$FRONTEND_IMAGE"

# Login to ACR
echo "Logging into Azure Container Registry..."
echo "${{ secrets.DEV_AZURE_SP_PASSWORD }}" | docker login "${{ secrets.DEV_ACR_LOGIN_SERVER }}" \
-u "${{ secrets.DEV_AZURE_SP_APP_ID }}" \
--password-stdin

# Pull and deploy (Dev: use base compose + override for pgadmin + exposed ports)
echo "Pulling Docker images..."
docker compose -f docker-compose.yml -f docker-compose.override.yml pull

echo "Starting services..."
docker compose -f docker-compose.yml -f docker-compose.override.yml up -d

# Wait for services to be healthy
echo "Waiting for services to be healthy..."
sleep 30

# Verify deployment - critical services must be running
echo "Verifying deployment..."
docker compose -f docker-compose.yml -f docker-compose.override.yml ps

# Health check: ensure backend is responding (with retry)
echo "Performing health check..."
MAX_RETRIES=10
RETRY_COUNT=0
HEALTH_CHECK_URL="http://${{ secrets.DEV_SSH_HOST }}/api/health"

while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
if curl -f -s "$HEALTH_CHECK_URL" > /dev/null 2>&1; then
echo "✅ Health check passed!"
break
fi

RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
echo "⏳ Health check attempt $RETRY_COUNT/$MAX_RETRIES failed, retrying in 5s..."
sleep 5
else
echo "❌ Health check failed after $MAX_RETRIES attempts!"
echo "Backend logs:"
docker logs snippetly-backend --tail 50 || true
exit 1
fi
done

echo "✅ Deployment successful! Cleaning up backup..."
rm -f .deploy.env.bak

# Cleanup old images (keep images from last 24 hours for dev)
echo "Cleaning up old Docker images..."
docker image prune -af --filter "until=24h" || true

echo "Dev deployment completed successfully!"
Loading