vm-tool 1.0.33__py3-none-any.whl → 1.0.39__py3-none-any.whl

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.
vm_tool/cli.py CHANGED
@@ -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
vm_tool/runner.py CHANGED
@@ -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
 
vm_tool/vm_setup/main.yml CHANGED
@@ -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
@@ -2,41 +2,4 @@
2
2
  hosts: all
3
3
  gather_facts: false
4
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('') }}"
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
@@ -24,7 +24,7 @@ vm_tool/alerting.py,sha256=6bNfQNSAQ_SJW9dQfB8s8gDZ-7ocYw4Q211VM6FWiXU,8269
24
24
  vm_tool/audit.py,sha256=spVtMcwadTkD9lELH1tur7Dr3OHjajk44ZatKYEbeVI,3388
25
25
  vm_tool/backup.py,sha256=WhwCXXJDYCQgoexroksNhWgB5ki6HUly0JhQ9ybCdMg,4130
26
26
  vm_tool/benchmarking.py,sha256=9AZ4JwKd5aEjwtKnhsuFa77y6WSO_fSEIqgMh3w_Btw,6212
27
- vm_tool/cli.py,sha256=Q2eAjs3bqrT4_y5CsuMLLEDHgaiR8oMWxlJfin9gdbo,28597
27
+ vm_tool/cli.py,sha256=PLq5CfO8p-6ppfXc_nm64NUZGD0vid9F_wmbizsdsig,28828
28
28
  vm_tool/cloud.py,sha256=1fQV1o3wCth55B1hSenME_j2n5gCJDo9gtUcqDxCs7s,4047
29
29
  vm_tool/completion.py,sha256=U8W8mmNdR0Ci0WjlEIa8CLOUtaVLZ5tWYpqViBBIBF8,7431
30
30
  vm_tool/compliance.py,sha256=7yXrvRoPxJMW0DTVhJ-ZxbaJo7quDSVgae2_mYbVAmE,3173
@@ -41,7 +41,7 @@ vm_tool/policy.py,sha256=Z05TLSqMu-tSM0_SnCdsIZqebHGRtXNSRLwkOBDthtY,6072
41
41
  vm_tool/rbac.py,sha256=hdFzh4QhUuQmGmMXBuG-o21FdEp1fb8WSJrCWAz-drI,3999
42
42
  vm_tool/recovery.py,sha256=fesho6Pi_ItRkdtiNK2bh-8Q_T98kSn2LZwKovMFsWI,5473
43
43
  vm_tool/reporting.py,sha256=yiLdArTfu7A8-PWL3dmFSRNpcMvBSq1iHNw6YJRO1hI,7419
44
- vm_tool/runner.py,sha256=C2pFRvKlXeXnmmbRiSVl45AiO-XmXMrB2u1fyzC9rQA,17451
44
+ vm_tool/runner.py,sha256=JoksxK31e2zVd4t-vHA8_GFrVvgeUngoMU9AFNxoxw4,17666
45
45
  vm_tool/secrets.py,sha256=bvbunxt4dLupFZQs3VUHkxDOASoBgtpggO0oavTuzOk,9397
46
46
  vm_tool/ssh.py,sha256=c9Nxs20VEq--qWCLZyc6uRqgny2-OCSwnTlcx9bZJtg,4905
47
47
  vm_tool/state.py,sha256=DxJoRLITwT8mWcs_eAgFNTDfcrGh4PMdQuFjdGb1n6Y,4079
@@ -54,10 +54,11 @@ vm_tool/strategies/canary.py,sha256=heLW3599IBXTp9m79MKB5Lo-XO93jUf8Ehs3cM_q_Q4,
54
54
  vm_tool/vm_setup/cleanup.yml,sha256=7eToWeIyoOEGWpm-bisoxymo1b-R8yPdF2AeukPyMUk,863
55
55
  vm_tool/vm_setup/inventory.yml,sha256=_dV8RYKfHA9vMq5WJg9jpplR8_R_lh6F0fA3tzAY6oY,34
56
56
  vm_tool/vm_setup/k8s.yml,sha256=Rn7dypJ_ccf_LxFSECuGFWpRrkX5svrt5IHJbjMmll0,342
57
- vm_tool/vm_setup/main.yml,sha256=i6iQ6c5yqWOlMEIK__rIEEEKEWDVOVEB9_9rnzg1rSU,651
57
+ vm_tool/vm_setup/main.yml,sha256=QUWUFf7W1y9dvfL-sfYIgh491cxRBTm521jI4he24Jg,657
58
58
  vm_tool/vm_setup/monitoring.yml,sha256=u4WhkO2P6O2Mrqo02z8G_FshcFjAbY1Avve5mb5sxZs,1090
59
59
  vm_tool/vm_setup/project_service.yml,sha256=YlvRx9XgW2X1MsKa9XWr7LWK-BET2zFly8Q-7cNedH4,545
60
- vm_tool/vm_setup/push_code.yml,sha256=B1e7OB-AsEL2mdWLu0M6n-9A14F06XCEFGflbjjZ7Vs,1707
60
+ vm_tool/vm_setup/push_code.yml,sha256=U5zqx04oV2S4U4VsXaecn8S9_UrZGEcTjKbhIZdCgs8,112
61
+ vm_tool/vm_setup/push_code_tasks.yml,sha256=dgPgcn3WAxff50GiWB7z2cWpndoqPZWOvij7DZzBxwM,1773
61
62
  vm_tool/vm_setup/setup.yml,sha256=D3qsBkzWEWEgeAmxO7bk99wxUaFImeSbZNVa3I2BXR8,659
62
63
  vm_tool/vm_setup/setup_project_env.yml,sha256=Q4K6ZgGfgP8pW-QKV3Wkvb0V82AGjHoWB9TM8xq2Nd0,274
63
64
  vm_tool/vm_setup/docker/create_docker_service.yml,sha256=C4nZpFBVzA7_xn0PEMIpYjXcYyA73ClxdMQgTh319eI,2140
@@ -65,9 +66,9 @@ vm_tool/vm_setup/docker/docker_setup.yml,sha256=kg6Abu3TjcLwV0JHnCAVUkj5l2HaGf7O
65
66
  vm_tool/vm_setup/docker/install_docker_and_compose.yml,sha256=NxPm4YkOekRH0dpJQVgxjcSqrmT6f912Dv0owYsLBxE,3402
66
67
  vm_tool/vm_setup/docker/login_to_docker_hub.yml,sha256=y9WaWLb1f1SuHVa1NNm24Gvf5bbwQ8eqEsImGLHGHGU,223
67
68
  vm_tool/vm_setup/github/git_configuration.yml,sha256=hKuzOFsVlYRoBAXujREfrLiqV7j4RnQYbL5s63AEAqk,2355
68
- vm_tool-1.0.33.dist-info/licenses/LICENSE,sha256=4OO6Zd_hYEOemzTNdgUR_E7oNvUJLuN2E7ZAgm7DcSM,1063
69
- vm_tool-1.0.33.dist-info/METADATA,sha256=xDKQOms427Z8kxbI4Es-3qKV3FDL_EvgoSCAs3lutUA,6191
70
- vm_tool-1.0.33.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
71
- vm_tool-1.0.33.dist-info/entry_points.txt,sha256=A2EAvw95ftFXzVAWfHKIM-SsxQVxrIrByRNe-ArOp2k,45
72
- vm_tool-1.0.33.dist-info/top_level.txt,sha256=jTLckJpKvJplpmKoMhPz2YKp_sQB9Q5-cCGmUHCp06M,17
73
- vm_tool-1.0.33.dist-info/RECORD,,
69
+ vm_tool-1.0.39.dist-info/licenses/LICENSE,sha256=4OO6Zd_hYEOemzTNdgUR_E7oNvUJLuN2E7ZAgm7DcSM,1063
70
+ vm_tool-1.0.39.dist-info/METADATA,sha256=6MURa9xBzCUWCcfFKEYP7W1A-3wzbBghfFCcczB7HE0,6191
71
+ vm_tool-1.0.39.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
72
+ vm_tool-1.0.39.dist-info/entry_points.txt,sha256=A2EAvw95ftFXzVAWfHKIM-SsxQVxrIrByRNe-ArOp2k,45
73
+ vm_tool-1.0.39.dist-info/top_level.txt,sha256=jTLckJpKvJplpmKoMhPz2YKp_sQB9Q5-cCGmUHCp06M,17
74
+ vm_tool-1.0.39.dist-info/RECORD,,