Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
Self-host Git and deploy

Self-host Git and deploy

Posted on November 20, 2025 by Toma Velev

You want a complete workflow for self-hosting Git, building Java web apps, and deploying them to remote servers. Let’s break it down step by step and provide a clear roadmap. I’ll include self-hosting options, CI/CD ideas, and deployment strategies.


1. Self-host a Git Repository

You have several options for self-hosting Git:

Option A: Git on a plain server

  • Install Git on a Linux server.
  • Create a bare repository:
# On server
mkdir -p /srv/git/myapp.git
cd /srv/git/myapp.git
git init --bare
  • Clone/push from your workstation:
git clone user@server:/srv/git/myapp.git
  • Pros: Lightweight, simple
  • Cons: No web UI, no advanced features

Option B: Use Git hosting software

  • Gitea (lightweight, fast, easy)
  • GitLab Community Edition (full-featured, heavier)
  • Bitbucket Server / SourceHut

Example: Gitea

# On server
wget -O gitea https://github.com/go-gitea/gitea/releases/download/v1.25.1/gitea-1.25.1-linux-amd64
chmod +x gitea
./gitea web
  • Access via web browser: http://server-ip:3000
  • Create repositories, manage users, webhooks.

2. Automate Builds for Java Web Apps

You can trigger builds either locally or using a CI/CD pipeline.

Option A: Using Maven/Gradle manually

  • Example Maven build:
mvn clean package
  • Produces a .war or .jar file for deployment.

Option B: CI/CD with a self-hosted runner

  • If you use Gitea: Gitea Actions or Drone CI
  • If you use GitLab CE: GitLab CI/CD
  • Example GitLab CI pipeline for Java:
stages:
  - build
  - deploy

build:
  stage: build
  image: maven:3.9.3-openjdk-17
  script:
    - mvn clean package
  artifacts:
    paths:
      - target/*.war

deploy:
  stage: deploy
  image: alpine:latest
  script:
    - apk add --no-cache openssh
    - scp target/myapp.war user@remote-server:/opt/tomcat/webapps/

3. Deploy Java Web Apps to Remote Servers

Option A: Copy WAR/JAR directly

  1. Build your .war or .jar.
  2. Use scp to copy it to the remote server:
scp target/myapp.war user@remote-server:/opt/tomcat/webapps/
  1. Restart the server if needed:
ssh user@remote-server 'systemctl restart tomcat'

Option B: Use automated deployment tools

  • Ansible – manage servers and deployments
  • Jenkins – classic CI/CD with deployment pipelines
  • Docker – package the app in a container and deploy
  • Kubernetes – for scalable deployments (optional)

4. Suggested Workflow

  1. Developer pushes code → self-hosted Git repository (Gitea/GitLab).
  2. CI/CD triggers → Maven/Gradle build.
  3. Artifacts produced → .war or .jar.
  4. Deployment step → SCP/Ansible/Docker to remote server.
  5. Server → Tomcat, WildFly, or Spring Boot app runs the app.

Optional Enhancements

  • Automatic rollback if deployment fails.
  • Health checks for remote servers after deployment.
  • SSL/TLS for self-hosted Git and apps.
  • Monitoring with Prometheus/Grafana or ELK stack.
  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)