vm-tool 1.0.33__tar.gz → 1.0.39__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. {vm_tool-1.0.33 → vm_tool-1.0.39}/PKG-INFO +1 -1
  2. vm_tool-1.0.39/codePushToGithub.py +203 -0
  3. {vm_tool-1.0.33 → vm_tool-1.0.39}/pyproject.toml +3 -2
  4. vm_tool-1.0.39/runtime.txt +1 -0
  5. {vm_tool-1.0.33 → vm_tool-1.0.39}/setup.py +1 -1
  6. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/cli.py +8 -1
  7. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/runner.py +7 -2
  8. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/main.yml +1 -1
  9. vm_tool-1.0.39/vm_tool/vm_setup/push_code.yml +5 -0
  10. vm_tool-1.0.39/vm_tool/vm_setup/push_code_tasks.yml +45 -0
  11. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/PKG-INFO +1 -1
  12. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/SOURCES.txt +3 -1
  13. vm_tool-1.0.33/codePushToGithub.sh +0 -47
  14. vm_tool-1.0.33/vm_tool/vm_setup/push_code.yml +0 -42
  15. {vm_tool-1.0.33 → vm_tool-1.0.39}/.devcontainer/devcontainer.json +0 -0
  16. {vm_tool-1.0.33 → vm_tool-1.0.39}/.github/dependabot.yml +0 -0
  17. {vm_tool-1.0.33 → vm_tool-1.0.39}/.github/workflows/ci.yml +0 -0
  18. {vm_tool-1.0.33 → vm_tool-1.0.39}/.github/workflows/deploy.yml +0 -0
  19. {vm_tool-1.0.33 → vm_tool-1.0.39}/.github/workflows/publish.yml +0 -0
  20. {vm_tool-1.0.33 → vm_tool-1.0.39}/.gitignore +0 -0
  21. {vm_tool-1.0.33 → vm_tool-1.0.39}/.pre-commit-config.yaml +0 -0
  22. {vm_tool-1.0.33 → vm_tool-1.0.39}/CONTRIBUTING +0 -0
  23. {vm_tool-1.0.33 → vm_tool-1.0.39}/CONTRIBUTING.md +0 -0
  24. {vm_tool-1.0.33 → vm_tool-1.0.39}/LICENSE +0 -0
  25. {vm_tool-1.0.33 → vm_tool-1.0.39}/MANIFEST.in +0 -0
  26. {vm_tool-1.0.33 → vm_tool-1.0.39}/Makefile +0 -0
  27. {vm_tool-1.0.33 → vm_tool-1.0.39}/README.md +0 -0
  28. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/MODULE_GUIDE.md +0 -0
  29. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/deployment-approaches.md +0 -0
  30. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/ec2-github-actions-guide.md +0 -0
  31. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/features.md +0 -0
  32. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/generator.md +0 -0
  33. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/index.md +0 -0
  34. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/pipeline-generator.md +0 -0
  35. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/reference/runner.md +0 -0
  36. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/reference/ssh.md +0 -0
  37. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/ssh-key-setup.md +0 -0
  38. {vm_tool-1.0.33 → vm_tool-1.0.39}/docs/usage.md +0 -0
  39. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/README.md +0 -0
  40. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/__init__.py +0 -0
  41. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/cloud/README.md +0 -0
  42. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/cloud/__init__.py +0 -0
  43. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/cloud/ssh_identity_file.py +0 -0
  44. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/cloud/ssh_password.py +0 -0
  45. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/cloud/template_cloud_setup.py +0 -0
  46. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/deploy_full_setup.py +0 -0
  47. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/docker-compose.example.yml +0 -0
  48. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/ec2-setup.sh +0 -0
  49. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/github-actions-ec2.yml +0 -0
  50. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/github-actions-full-setup.yml +0 -0
  51. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/local/.keep +0 -0
  52. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/local/README.md +0 -0
  53. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/local/__init__.py +0 -0
  54. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/local/template_local_setup.py +0 -0
  55. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/production-deploy.sh +0 -0
  56. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/rollback.sh +0 -0
  57. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/setup.sh +0 -0
  58. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/ssh_key_management.py +0 -0
  59. {vm_tool-1.0.33 → vm_tool-1.0.39}/examples/version_check.sh +0 -0
  60. {vm_tool-1.0.33 → vm_tool-1.0.39}/mkdocs.yml +0 -0
  61. {vm_tool-1.0.33 → vm_tool-1.0.39}/molecule/default/converge.yml +0 -0
  62. {vm_tool-1.0.33 → vm_tool-1.0.39}/molecule/default/molecule.yml +0 -0
  63. {vm_tool-1.0.33 → vm_tool-1.0.39}/molecule/default/verify.yml +0 -0
  64. {vm_tool-1.0.33 → vm_tool-1.0.39}/requirements-docs.txt +0 -0
  65. {vm_tool-1.0.33 → vm_tool-1.0.39}/requirements.txt +0 -0
  66. {vm_tool-1.0.33 → vm_tool-1.0.39}/setup.cfg +0 -0
  67. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/conftest.py +0 -0
  68. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/integration/test_deployment.py +0 -0
  69. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_config.py +0 -0
  70. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_generator.py +0 -0
  71. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_health.py +0 -0
  72. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_history.py +0 -0
  73. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_logging.py +0 -0
  74. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_runner.py +0 -0
  75. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_ssh.py +0 -0
  76. {vm_tool-1.0.33 → vm_tool-1.0.39}/tests/test_state.py +0 -0
  77. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/__init__.py +0 -0
  78. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/alerting.py +0 -0
  79. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/audit.py +0 -0
  80. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/backup.py +0 -0
  81. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/benchmarking.py +0 -0
  82. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/cloud.py +0 -0
  83. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/completion.py +0 -0
  84. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/compliance.py +0 -0
  85. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/config.py +0 -0
  86. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/drift.py +0 -0
  87. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/generator.py +0 -0
  88. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/health.py +0 -0
  89. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/history.py +0 -0
  90. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/kubernetes.py +0 -0
  91. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/metrics.py +0 -0
  92. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/notifications.py +0 -0
  93. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/plugins.py +0 -0
  94. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/policy.py +0 -0
  95. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/rbac.py +0 -0
  96. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/recovery.py +0 -0
  97. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/reporting.py +0 -0
  98. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/secrets.py +0 -0
  99. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/ssh.py +0 -0
  100. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/state.py +0 -0
  101. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/strategies/__init__.py +0 -0
  102. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/strategies/ab_testing.py +0 -0
  103. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/strategies/blue_green.py +0 -0
  104. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/strategies/canary.py +0 -0
  105. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/validation.py +0 -0
  106. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/cleanup.yml +0 -0
  107. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/docker/create_docker_service.yml +0 -0
  108. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/docker/docker_setup.yml +0 -0
  109. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/docker/install_docker_and_compose.yml +0 -0
  110. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/docker/login_to_docker_hub.yml +0 -0
  111. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/github/git_configuration.yml +0 -0
  112. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/inventory.yml +0 -0
  113. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/k8s.yml +0 -0
  114. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/monitoring.yml +0 -0
  115. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/project_service.yml +0 -0
  116. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/setup.yml +0 -0
  117. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/vm_setup/setup_project_env.yml +0 -0
  118. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool/webhooks.py +0 -0
  119. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/dependency_links.txt +0 -0
  120. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/entry_points.txt +0 -0
  121. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/requires.txt +0 -0
  122. {vm_tool-1.0.33 → vm_tool-1.0.39}/vm_tool.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vm_tool
3
- Version: 1.0.33
3
+ Version: 1.0.39
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  Author: Sunny Sinha
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Script to automate git commits and pushes with version bumping for main branch.
4
+ Automatically manages virtual environment and dependencies.
5
+ """
6
+ import subprocess
7
+ import sys
8
+ import os
9
+ from pathlib import Path
10
+
11
+
12
+ def run_command(cmd, check=True, shell=True):
13
+ """Run a shell command and return the result."""
14
+ try:
15
+ result = subprocess.run(
16
+ cmd, shell=shell, check=check, capture_output=True, text=True
17
+ )
18
+ if result.stdout:
19
+ print(result.stdout)
20
+ return result
21
+ except subprocess.CalledProcessError as e:
22
+ print(f"Error running command: {cmd}")
23
+ if e.stderr:
24
+ print(f"Error: {e.stderr}")
25
+ sys.exit(1)
26
+
27
+
28
+ def get_venv_path():
29
+ """Get the virtual environment path."""
30
+ return Path(__file__).parent / "venv"
31
+
32
+
33
+ def get_python_executable():
34
+ """Get the Python executable path for the virtual environment."""
35
+ venv_path = get_venv_path()
36
+ if os.name == "nt": # Windows
37
+ return venv_path / "Scripts" / "python.exe"
38
+ else: # Unix/Linux/Mac
39
+ return venv_path / "bin" / "python"
40
+
41
+
42
+ def get_pip_executable():
43
+ """Get the pip executable path for the virtual environment."""
44
+ venv_path = get_venv_path()
45
+ if os.name == "nt": # Windows
46
+ return venv_path / "Scripts" / "pip.exe"
47
+ else: # Unix/Linux/Mac
48
+ return venv_path / "bin" / "pip"
49
+
50
+
51
+ def create_venv():
52
+ """Create a virtual environment if it doesn't exist."""
53
+ venv_path = get_venv_path()
54
+
55
+ if not venv_path.exists():
56
+ print("📦 Creating virtual environment...")
57
+ run_command(f'"{sys.executable}" -m venv venv')
58
+ print("✅ Virtual environment created!")
59
+ return True
60
+ return False
61
+
62
+
63
+ def install_dependencies():
64
+ """Install required dependencies in the virtual environment."""
65
+ python_exe = get_python_executable()
66
+
67
+ print("📦 Installing/updating dependencies...")
68
+ # Use python -m pip instead of direct pip executable (Windows compatibility)
69
+ run_command(f'"{python_exe}" -m pip install --upgrade pip')
70
+ run_command(f'"{python_exe}" -m pip install bump-my-version')
71
+
72
+ # Install project dependencies if requirements.txt exists
73
+ if Path("requirements.txt").exists():
74
+ run_command(f'"{python_exe}" -m pip install -r requirements.txt')
75
+
76
+ print("✅ Dependencies installed!")
77
+
78
+
79
+ def setup_environment():
80
+ """Setup virtual environment and dependencies."""
81
+ venv_created = create_venv()
82
+
83
+ # Always install/update dependencies if venv was just created
84
+ if venv_created:
85
+ install_dependencies()
86
+ else:
87
+ # Check if bump-my-version is available
88
+ python_exe = get_python_executable()
89
+ result = run_command(f'"{python_exe}" -m pip show bump-my-version', check=False)
90
+ if result.returncode != 0:
91
+ print("⚠️ bump-my-version not found, installing dependencies...")
92
+ install_dependencies()
93
+
94
+
95
+ def run_in_venv(cmd):
96
+ """Run a command using the virtual environment's Python."""
97
+ python_exe = get_python_executable()
98
+
99
+ # For bump-my-version, we need to use the venv's Scripts directory
100
+ venv_path = get_venv_path()
101
+ if os.name == "nt":
102
+ bump_exe = venv_path / "Scripts" / "bump-my-version.exe"
103
+ else:
104
+ bump_exe = venv_path / "bin" / "bump-my-version"
105
+
106
+ # Replace bump-my-version command with full path
107
+ if cmd.startswith("bump-my-version"):
108
+ cmd = cmd.replace("bump-my-version", f'"{bump_exe}"')
109
+ # Add verbose flag to show what's happening
110
+ if "--verbose" not in cmd and "-v" not in cmd:
111
+ cmd = cmd.replace("bump patch", "bump patch --verbose")
112
+
113
+ return run_command(cmd)
114
+
115
+
116
+ def get_current_version():
117
+ """Read the current version from pyproject.toml."""
118
+ try:
119
+ with open("pyproject.toml", "r") as f:
120
+ for line in f:
121
+ if line.strip().startswith("version ="):
122
+ # Extract version from line like: version = "1.0.34"
123
+ version = line.split("=")[1].strip().strip('"').strip("'")
124
+ return version
125
+ except Exception as e:
126
+ print(f"Warning: Could not read current version: {e}")
127
+ return "unknown"
128
+
129
+
130
+ def main():
131
+ # Setup virtual environment
132
+ print("🔧 Setting up environment...")
133
+ setup_environment()
134
+ print()
135
+
136
+ # Ask for the branch name
137
+ branch_name = input("Enter the branch name: ").strip()
138
+
139
+ if branch_name == "main":
140
+ # 1. Commit User Changes FIRST
141
+ print("Adding changes...")
142
+ run_command("git add .")
143
+
144
+ commit_message = input("Enter the commit message for your changes: ").strip()
145
+ print("Committing changes...")
146
+ run_command(f'git commit -m "{commit_message}"')
147
+
148
+ # 2. Bump Version (which creates a new commit and tag)
149
+ current_version = get_current_version()
150
+ print("\n" + "=" * 60)
151
+ print(f"🔢 Bumping version from {current_version}...")
152
+ print("=" * 60)
153
+ run_in_venv("bump-my-version bump patch --allow-dirty")
154
+
155
+ # Get new version after bump
156
+ new_version = get_current_version()
157
+ print("\n" + "=" * 60)
158
+ print(f"✅ Version bumped: {current_version} → {new_version}")
159
+ print("=" * 60 + "\n")
160
+
161
+ # 3. Push everything
162
+ print("Pushing to main...")
163
+ run_command("git push origin main")
164
+
165
+ # Push tags to trigger PyPI publish
166
+ print("Pushing tags...")
167
+ run_command("git push origin --tags")
168
+
169
+ # Pull latest changes
170
+ print("Pulling latest changes...")
171
+ run_command("git pull origin main")
172
+
173
+ print("✅ Successfully pushed to main with version bump!")
174
+
175
+ else:
176
+ # Create and switch to the new branch
177
+ print(f"Creating and switching to branch: {branch_name}")
178
+ run_command(f"git checkout -b {branch_name}")
179
+
180
+ # Add all changes
181
+ print("Adding changes...")
182
+ run_command("git add .")
183
+
184
+ # Ask for commit message
185
+ commit_message = input("Enter the commit message: ").strip()
186
+
187
+ # Commit with the entered message
188
+ print("Committing changes...")
189
+ run_command(f'git commit -m "{commit_message}"')
190
+
191
+ # Push changes to the specified branch
192
+ print(f"Pushing to {branch_name}...")
193
+ run_command(f"git push origin {branch_name}")
194
+
195
+ # Switch back to main
196
+ print("Switching back to main...")
197
+ run_command("git checkout main")
198
+
199
+ print(f"✅ Successfully pushed to {branch_name}!")
200
+
201
+
202
+ if __name__ == "__main__":
203
+ main()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vm_tool"
7
- version = "1.0.33"
7
+ version = "1.0.39"
8
8
  description = "A Comprehensive Tool for Setting Up Virtual Machines."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -66,6 +66,7 @@ upload_to_pypi = true
66
66
  upload_to_release = true
67
67
  build_command = "python setup.py sdist bdist_wheel"
68
68
 
69
+
69
70
  [tool.black]
70
71
  line-length = 88
71
72
  target-version = ['py39', 'py310', 'py311', 'py312']
@@ -75,7 +76,7 @@ include = '\.pyi?$'
75
76
  profile = "black"
76
77
  multi_line_output = 3
77
78
  [tool.bumpversion]
78
- current_version = "1.0.33"
79
+ current_version = "1.0.39"
79
80
  commit = true
80
81
  tag = true
81
82
 
@@ -0,0 +1 @@
1
+ python-3.9
@@ -12,7 +12,7 @@ else:
12
12
 
13
13
  setup(
14
14
  name="vm_tool",
15
- version="1.0.33", # This will be updated by bump2version
15
+ version="1.0.39", # This will be updated by bump2version
16
16
  packages=find_packages(),
17
17
  description="A Comprehensive Tool for Setting Up Virtual Machines.",
18
18
  long_description=long_description,
@@ -6,7 +6,7 @@ def main():
6
6
  parser = argparse.ArgumentParser(
7
7
  description="VM Tool: Setup, Provision, and Manage VMs"
8
8
  )
9
- parser.add_argument("--version", action="version", version="1.0.33")
9
+ parser.add_argument("--version", action="version", version="1.0.39")
10
10
  parser.add_argument(
11
11
  "--verbose", "-v", action="store_true", help="Enable verbose output"
12
12
  )
@@ -236,6 +236,12 @@ def main():
236
236
  action="store_true",
237
237
  help="Preview deployment without executing (shows what would be deployed)",
238
238
  )
239
+ docker_parser.add_argument(
240
+ "--project-dir",
241
+ type=str,
242
+ default="~/app",
243
+ help="Target directory on the server for deployment (default: ~/app)",
244
+ )
239
245
 
240
246
  # Completion command
241
247
  completion_parser = subparsers.add_parser(
@@ -600,6 +606,7 @@ def main():
600
606
  env_file=args.env_file,
601
607
  deploy_command=args.deploy_command,
602
608
  force=args.force,
609
+ project_dir=args.project_dir,
603
610
  )
604
611
 
605
612
  # Run health checks if specified
@@ -320,6 +320,7 @@ class SetupRunner:
320
320
  env_file: str = None,
321
321
  deploy_command: str = None,
322
322
  force: bool = False,
323
+ project_dir: str = "~/app",
323
324
  ):
324
325
  """Runs the Docker Compose deployment with idempotency."""
325
326
  from vm_tool.state import DeploymentState
@@ -373,7 +374,11 @@ class SetupRunner:
373
374
  with open(generated_inventory_path, "w") as f:
374
375
  yaml.dump(inventory_content, f)
375
376
 
376
- target_inventory = "generated_inventory.yml"
377
+ target_inventory = generated_inventory_path
378
+
379
+ else:
380
+ # If not generating dynamic inventory, ensure the provided inventory path is absolute
381
+ target_inventory = os.path.abspath(inventory_file)
377
382
 
378
383
  logger.info(
379
384
  f"Starting Docker deployment using {compose_file} on {target_inventory}..."
@@ -387,7 +392,7 @@ class SetupRunner:
387
392
  "GITHUB_PROJECT_URL": self.github_project_url,
388
393
  "DEPLOY_MODE": "push",
389
394
  "SOURCE_PATH": os.getcwd(), # Current working directory where vm_tool is run
390
- "project_dest_dir": "~/app",
395
+ "project_dest_dir": project_dir,
391
396
  "GITHUB_REPOSITORY_OWNER": os.environ.get("GITHUB_REPOSITORY_OWNER", ""),
392
397
  }
393
398
 
@@ -11,7 +11,7 @@
11
11
  when: DEPLOY_MODE | default('pull') != 'push'
12
12
 
13
13
  - name: Push Code (Zero Touch)
14
- include_tasks: push_code.yml
14
+ include_tasks: push_code_tasks.yml
15
15
  when: DEPLOY_MODE | default('pull') == 'push'
16
16
 
17
17
  - name: Setup Project Environment File
@@ -0,0 +1,5 @@
1
+ - name: Push Code Playbook
2
+ hosts: all
3
+ gather_facts: false
4
+ tasks:
5
+ - include_tasks: push_code_tasks.yml
@@ -0,0 +1,45 @@
1
+ - name: Ensure project directory exists
2
+ file:
3
+ path: "{{ project_dest_dir }}"
4
+ state: directory
5
+ mode: '0755'
6
+
7
+ - name: Copy project files to target
8
+ copy:
9
+ src: "{{ playbook_dir }}/../../"
10
+ dest: "{{ project_dest_dir }}/"
11
+ # Note: In ansible-runner, playbook_dir is inside private_data_dir/project/vm_setup.
12
+ # We need to be careful about the source path.
13
+ # However, ansible_runner isolates execution.
14
+ # Better approach: Pass SOURCE_PATH as extravar.
15
+ when: false # Placeholder, we will use synchronize or better strategy.
16
+
17
+ # Re-thinking: simple 'copy' of just the compose file is safer for now if we don't know build context.
18
+ # But usually context is needed.
19
+ # Let's rely on 'synchronize' (rsync) if available, or just copy the compose file if user only provided that.
20
+
21
+ # For MVP of 'deploy-docker', let's copy the DOCKER_COMPOSE_FILE_PATH and .env if exists.
22
+ - name: Ensure Docker Compose file parent directory exists
23
+ file:
24
+ path: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH | dirname }}"
25
+ state: directory
26
+ mode: '0755'
27
+ when: DOCKER_COMPOSE_FILE_PATH is defined and (DOCKER_COMPOSE_FILE_PATH | dirname) != ''
28
+
29
+ - name: Copy Docker Compose file
30
+ copy:
31
+ src: "{{ SOURCE_PATH }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
32
+ dest: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
33
+
34
+ - name: Copy Env file
35
+ copy:
36
+ src: "{{ SOURCE_PATH }}/{{ ENV_FILE_PATH | default('.env') }}"
37
+ dest: "{{ project_dest_dir }}/{{ ENV_FILE_PATH | default('.env') }}"
38
+ failed_when: false
39
+
40
+ - name: Deploy application
41
+ shell: "{{ DEPLOY_COMMAND | default('docker-compose up -d --remove-orphans') }}"
42
+ args:
43
+ chdir: "{{ project_dest_dir }}"
44
+ environment:
45
+ GITHUB_REPOSITORY_OWNER: "{{ GITHUB_REPOSITORY_OWNER | default('') }}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vm_tool
3
- Version: 1.0.33
3
+ Version: 1.0.39
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  Author: Sunny Sinha
@@ -6,11 +6,12 @@ LICENSE
6
6
  MANIFEST.in
7
7
  Makefile
8
8
  README.md
9
- codePushToGithub.sh
9
+ codePushToGithub.py
10
10
  mkdocs.yml
11
11
  pyproject.toml
12
12
  requirements-docs.txt
13
13
  requirements.txt
14
+ runtime.txt
14
15
  setup.py
15
16
  .devcontainer/devcontainer.json
16
17
  .github/dependabot.yml
@@ -107,6 +108,7 @@ vm_tool/vm_setup/main.yml
107
108
  vm_tool/vm_setup/monitoring.yml
108
109
  vm_tool/vm_setup/project_service.yml
109
110
  vm_tool/vm_setup/push_code.yml
111
+ vm_tool/vm_setup/push_code_tasks.yml
110
112
  vm_tool/vm_setup/setup.yml
111
113
  vm_tool/vm_setup/setup_project_env.yml
112
114
  vm_tool/vm_setup/docker/create_docker_service.yml
@@ -1,47 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Navigate to the directory
4
- script_directory="$(dirname "$0")"
5
-
6
- # Navigate to the script's directory
7
- cd "$script_directory"
8
-
9
- # Ask for the branch name
10
- read -p "Enter the branch name: " branch_name
11
-
12
- # Check if the branch name is "main"
13
- if [ "$branch_name" = "main" ]; then
14
-
15
- bump-my-version bump patch --allow-dirty
16
-
17
- # Add all changes
18
- git add .
19
-
20
- # Ask for the commit message
21
- read -p "Enter the commit message: " commit_message
22
-
23
- # Commit with the entered message
24
- git commit -m "$commit_message"
25
-
26
- # Push changes directly to the "main" branch
27
- git push origin main
28
-
29
- git pull origin main
30
- else
31
- # Create and switch to the new branch
32
- git checkout -b "$branch_name"
33
-
34
- # Add all changes
35
- git add .
36
-
37
- # Ask for the commit message
38
- read -p "Enter the commit message: " commit_message
39
-
40
- # Commit with the entered message
41
- git commit -m "$commit_message"
42
-
43
- # Push changes to the specified branch
44
- git push origin "$branch_name"
45
-
46
- git checkout main
47
- fi
@@ -1,42 +0,0 @@
1
- - name: Push Code Playbook
2
- hosts: all
3
- gather_facts: false
4
- tasks:
5
- - name: Ensure project directory exists
6
- file:
7
- path: "{{ project_dest_dir }}"
8
- state: directory
9
- mode: '0755'
10
-
11
- - name: Copy project files to target
12
- copy:
13
- src: "{{ playbook_dir }}/../../"
14
- dest: "{{ project_dest_dir }}/"
15
- # Note: In ansible-runner, playbook_dir is inside private_data_dir/project/vm_setup.
16
- # We need to be careful about the source path.
17
- # However, ansible_runner isolates execution.
18
- # Better approach: Pass SOURCE_PATH as extravar.
19
- when: false # Placeholder, we will use synchronize or better strategy.
20
-
21
- # Re-thinking: simple 'copy' of just the compose file is safer for now if we don't know build context.
22
- # But usually context is needed.
23
- # Let's rely on 'synchronize' (rsync) if available, or just copy the compose file if user only provided that.
24
-
25
- # For MVP of 'deploy-docker', let's copy the DOCKER_COMPOSE_FILE_PATH and .env if exists.
26
- - name: Copy Docker Compose file
27
- copy:
28
- src: "{{ SOURCE_PATH }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
29
- dest: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH }}"
30
-
31
- - name: Copy Env file
32
- copy:
33
- src: "{{ SOURCE_PATH }}/{{ ENV_FILE_PATH | default('.env') }}"
34
- dest: "{{ project_dest_dir }}/{{ ENV_FILE_PATH | default('.env') }}"
35
- failed_when: false
36
-
37
- - name: Deploy application
38
- shell: "{{ DEPLOY_COMMAND | default('docker-compose up -d --remove-orphans') }}"
39
- args:
40
- chdir: "{{ project_dest_dir }}"
41
- environment:
42
- GITHUB_REPOSITORY_OWNER: "{{ GITHUB_REPOSITORY_OWNER | default('') }}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes