From 1ed50c9969132f0ec9ee41c0111f19d02486ae97 Mon Sep 17 00:00:00 2001 From: Rodrigo Verdiani Date: Tue, 28 Oct 2025 20:22:08 -0300 Subject: [PATCH 1/4] feat: add pipeline v1 --- .gitignore | 251 ++++++++++++++++++++++++++++++++++++++ .woodpecker/pipeline.yaml | 24 ++++ docker-compose.yml | 7 ++ 3 files changed, 282 insertions(+) create mode 100644 .gitignore create mode 100644 .woodpecker/pipeline.yaml create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ffa141 --- /dev/null +++ b/.gitignore @@ -0,0 +1,251 @@ +# Created by https://www.toptal.com/developers/gitignore/api/linux,intellij,jetbrains,java,react +# Edit at https://www.toptal.com/developers/gitignore?templates=linux,intellij,jetbrains,java,react + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +__pycache__ + +# User-specific stuff +.idea/** +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### JetBrains ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### JetBrains Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### react ### +.DS_* +logs +**/*.backup.* +**/*.back.* + +node_modules +bower_components + +*.sublime* + +psd +thumb +sketch + +# End of https://www.toptal.com/developers/gitignore/api/linux,intellij,jetbrains,java,react diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml new file mode 100644 index 0000000..eb32d51 --- /dev/null +++ b/.woodpecker/pipeline.yaml @@ -0,0 +1,24 @@ +# .woodpecker.yml + +when: + event: [ push, pull_request ] + branch: [ main, develop, feat/*, feature/* ] + +# Pipeline steps +steps: + - name: publish-image + image: woodpeckerci/plugin-docker-buildx + settings: + platforms: linux/amd64 + repo: git.badger-pirarucu.ts.net/mangamochi/manga-matcher + registry: git.badger-pirarucu.ts.net + username: + from_secret: DOCKER_USER + password: + from_secret: DOCKER_PASSWORD + tags: + - latest + - ${CI_COMMIT_SHA} + when: + event: [ push, pull_request ] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e433314 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + manga-matcher: + build: + context: . + dockerfile: Dockerfile + ports: + - "3000:3000" \ No newline at end of file -- 2.49.1 From 8322c871af771f5b24931a854a0802acece628d8 Mon Sep 17 00:00:00 2001 From: Rodrigo Verdiani Date: Tue, 28 Oct 2025 20:41:56 -0300 Subject: [PATCH 2/4] feat: add pipeline v2 --- .woodpecker/pipeline.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml index eb32d51..5dfd051 100644 --- a/.woodpecker/pipeline.yaml +++ b/.woodpecker/pipeline.yaml @@ -21,4 +21,36 @@ steps: - ${CI_COMMIT_SHA} when: event: [ push, pull_request ] + + - name: deploy + image: alpine:3.20 + environment: + DEPLOY_USER: rov + DEPLOY_HOST: mangamochi.badger-pirarucu.ts.net + DEPLOY_PORT: 22 + IMAGE: git.badger-pirarucu.ts.net/mangamochi/manga-matcher:${CI_COMMIT_SHA} + secrets: [ DEPLOY_SSH_KEY ] + commands: + - echo "🚀 Deploying to $DEPLOY_HOST ..." + - apk add --no-cache openssh-client docker-cli + # Setup SSH key + - mkdir -p ~/.ssh + - echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + # Add host to known_hosts to prevent prompt + - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts + # Run deployment commands remotely + - > + ssh -p $DEPLOY_PORT $DEPLOY_USER@$DEPLOY_HOST " + docker pull $IMAGE && + docker stop manga-matcher || true && + docker rm manga-matcher || true && + docker run -d + --name manga-matcher + --restart always + -p 8000:8000 + $IMAGE + " + when: + event: [ push, pull_request ] -- 2.49.1 From 65106dea824a17881f0acbf979211f6b742bb6e1 Mon Sep 17 00:00:00 2001 From: Rodrigo Verdiani Date: Tue, 28 Oct 2025 20:43:29 -0300 Subject: [PATCH 3/4] feat: add pipeline v3 --- .woodpecker/pipeline.yaml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml index 5dfd051..5e37ab8 100644 --- a/.woodpecker/pipeline.yaml +++ b/.woodpecker/pipeline.yaml @@ -32,24 +32,24 @@ steps: secrets: [ DEPLOY_SSH_KEY ] commands: - echo "🚀 Deploying to $DEPLOY_HOST ..." - - apk add --no-cache openssh-client docker-cli - # Setup SSH key - - mkdir -p ~/.ssh - - echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa - - chmod 600 ~/.ssh/id_rsa - # Add host to known_hosts to prevent prompt - - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts - # Run deployment commands remotely - - > + - apk add --no-cache openssh-client docker-cli + # Setup SSH key + - mkdir -p ~/.ssh + - echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + # Add host to known_hosts to prevent prompt + - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts + # Run deployment commands remotely + - > ssh -p $DEPLOY_PORT $DEPLOY_USER@$DEPLOY_HOST " - docker pull $IMAGE && - docker stop manga-matcher || true && - docker rm manga-matcher || true && - docker run -d - --name manga-matcher - --restart always - -p 8000:8000 - $IMAGE + docker pull $IMAGE && + docker stop manga-matcher || true && + docker rm manga-matcher || true && + docker run -d + --name manga-matcher + --restart always + -p 8000:8000 + $IMAGE " when: event: [ push, pull_request ] -- 2.49.1 From c10d0c7474de89a55d7a817a7055a7a36edbb107 Mon Sep 17 00:00:00 2001 From: Rodrigo Verdiani Date: Tue, 28 Oct 2025 20:48:11 -0300 Subject: [PATCH 4/4] feat: add pipeline v4 --- .woodpecker/pipeline.yaml | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml index 5e37ab8..a2d41f3 100644 --- a/.woodpecker/pipeline.yaml +++ b/.woodpecker/pipeline.yaml @@ -1,10 +1,11 @@ # .woodpecker.yml +# ----------------- +# Build, publish, and deploy Python app when: - event: [ push, pull_request ] - branch: [ main, develop, feat/*, feature/* ] + event: [ push ] + branch: [ main ] -# Pipeline steps steps: - name: publish-image image: woodpeckerci/plugin-docker-buildx @@ -20,37 +21,34 @@ steps: - latest - ${CI_COMMIT_SHA} when: - event: [ push, pull_request ] + event: [ push ] + branch: [ main ] - name: deploy + depends_on: [ publish-image ] image: alpine:3.20 environment: DEPLOY_USER: rov DEPLOY_HOST: mangamochi.badger-pirarucu.ts.net DEPLOY_PORT: 22 IMAGE: git.badger-pirarucu.ts.net/mangamochi/manga-matcher:${CI_COMMIT_SHA} - secrets: [ DEPLOY_SSH_KEY ] + DEPLOY_SSH_KEY: + from_secret: DEPLOY_SSH_KEY commands: - echo "🚀 Deploying to $DEPLOY_HOST ..." - apk add --no-cache openssh-client docker-cli - # Setup SSH key - mkdir -p ~/.ssh - echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - # Add host to known_hosts to prevent prompt - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts - # Run deployment commands remotely - > ssh -p $DEPLOY_PORT $DEPLOY_USER@$DEPLOY_HOST " docker pull $IMAGE && - docker stop manga-matcher || true && - docker rm manga-matcher || true && - docker run -d - --name manga-matcher - --restart always - -p 8000:8000 - $IMAGE + docker stop manga-matcher 2>/dev/null || true && + docker rm manga-matcher 2>/dev/null || true && + docker run -d --name manga-matcher --restart always -p 8000:8000 $IMAGE " when: - event: [ push, pull_request ] + event: [ push ] + branch: [ main ] -- 2.49.1