mantis-cli 9.0.1__tar.gz → 9.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: mantis-cli
3
- Version: 9.0.1
3
+ Version: 9.0.2
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -0,0 +1 @@
1
+ VERSION = '9.0.2'
@@ -532,7 +532,6 @@ class DefaultManager(object):
532
532
  image = service_build.get('image', self.get_image_name(service))
533
533
  dockerfile = f"{self.config['build'].get('context', '.')}{service_build['dockerfile']}"
534
534
  CLI.info(f'Building image {image} from {dockerfile}...')
535
- steps = 1
536
535
 
537
536
  if not os.path.exists(dockerfile):
538
537
  CLI.error(f'Dockerfile {dockerfile} not found')
@@ -541,7 +540,7 @@ class DefaultManager(object):
541
540
  DOCKER_TAG = self.config['build']['tag']
542
541
  DOCKER_REPOSITORY_AND_TAG = f'{DOCKER_REPOSITORY}:{DOCKER_TAG}'
543
542
 
544
- CLI.step(1, steps, f'Building Docker image [{DOCKER_REPOSITORY_AND_TAG}]...')
543
+ CLI.warning(f'Building Docker image [{DOCKER_REPOSITORY_AND_TAG}]...')
545
544
 
546
545
  build_args = self.config['build']['args']
547
546
  build_args = ','.join(map('='.join, build_args.items()))
@@ -593,8 +592,6 @@ class DefaultManager(object):
593
592
  if not self.connection:
594
593
  return CLI.warning('Connection not defined. Skipping uploading files')
595
594
 
596
- steps = 1
597
-
598
595
  mapping = {
599
596
  'services': {
600
597
  self.database_config: f'{self.project_path}/{self.configs_path}/{self.DATABASE}/',
@@ -614,11 +611,11 @@ class DefaultManager(object):
614
611
  self.upload('compose')
615
612
  self.upload('mantis')
616
613
  elif context == 'services':
617
- CLI.step(1, steps, 'Uploading configs for context "services" [webserver, database, cache, htpasswd]')
614
+ CLI.warning('Uploading configs for context "services" [webserver, database, cache, htpasswd]')
618
615
  elif context == 'compose':
619
- CLI.step(1, steps, 'Uploading configs for context "compose" [docker compose configs and environment]')
616
+ CLI.warning('Uploading configs for context "compose" [docker compose configs and environment]')
620
617
  elif context == 'mantis':
621
- CLI.step(1, steps, 'Uploading configs for mantis [mantis.json]')
618
+ CLI.warning('Uploading configs for mantis [mantis.json]')
622
619
  else:
623
620
  CLI.error(f'Unknown context "{context}". Available: services, compose, mantis or all')
624
621
 
@@ -657,30 +654,28 @@ class DefaultManager(object):
657
654
 
658
655
  def restart(self):
659
656
  CLI.info('Restarting...')
660
- steps = 3
657
+ steps = 4
661
658
 
662
- CLI.step(1, steps, 'Stopping and removing Docker containers...')
659
+ # run down project containers
660
+ CLI.step(1, steps, 'Running down project containers...')
661
+ self.down()
663
662
 
664
- # stop and remove all containers with project prefix
665
- # containers = self.get_containers_starting_with(self.CONTAINER_PREFIX)
663
+ # stop and remove all other containers
664
+ CLI.step(2, steps, 'Stopping and removing remaining containers...')
666
665
 
667
- # stop and remove all containers
668
666
  containers = self.get_containers()
669
667
 
670
668
  for container in containers:
671
669
  self.docker(f'container stop {container}', return_output=True)
672
670
  self.docker(f'container rm {container}')
673
671
 
674
- # for service in self.config['containers']['deploy']['zero_downtime'] + self.config['containers']['deploy']['restart']:
675
- # container = self.get_container_name(service)
676
- # self.docker(f'container stop {container}', return_output=True)
677
- # self.docker(f'container rm {container}')
678
-
679
- CLI.step(2, steps, 'Recreating Docker containers...')
680
- self.docker_compose(f'--project-name={self.PROJECT_NAME} up -d')
672
+ # recreate project
673
+ CLI.step(3, steps, 'Recreating project containers...')
674
+ self.up()
681
675
 
682
- CLI.step(3, steps, 'Prune Docker images and volumes')
683
- self.docker(f'system prune --volumes --force')
676
+ # clean
677
+ CLI.step(4, steps, 'Prune Docker images and volumes')
678
+ self.clean()
684
679
 
685
680
  def deploy(self):
686
681
  CLI.info('Deploying...')
@@ -710,8 +705,6 @@ class DefaultManager(object):
710
705
  num_retries = 30
711
706
  # num_retries = 20
712
707
 
713
- print(self.get_containers())
714
-
715
708
  self.healthcheck(retries=num_retries, service=f'{service}-new', break_if_successful=True)
716
709
 
717
710
  # rename old container
@@ -789,24 +782,15 @@ class DefaultManager(object):
789
782
  self.docker(f'container start {container}')
790
783
 
791
784
  def run(self, params):
792
- CLI.info('Run...')
793
- steps = 1
794
-
795
- CLI.step(1, steps, f'Running {params}...')
785
+ CLI.info(f'Running {params}...')
796
786
  self.docker_compose(f'--project-name={self.PROJECT_NAME} run {params}')
797
787
 
798
788
  def up(self, params=''):
799
- CLI.info('Up...')
800
- steps = 1
801
-
802
- CLI.step(1, steps, f'Starting up {params}...')
789
+ CLI.info(f'Starting up {params}...')
803
790
  self.docker_compose(f'--project-name={self.PROJECT_NAME} up {params} -d')
804
791
 
805
792
  def down(self, params=''):
806
- CLI.info('Down...')
807
- steps = 1
808
-
809
- CLI.step(1, steps, f'Running down {params}...')
793
+ CLI.info(f'Running down {params}...')
810
794
  self.docker_compose(f'--project-name={self.PROJECT_NAME} down {params}')
811
795
 
812
796
  def remove(self, params=''):
@@ -822,9 +806,6 @@ class DefaultManager(object):
822
806
 
823
807
  def clean(self): # todo clean on all nodes
824
808
  CLI.info('Cleaning...')
825
- steps = 1
826
-
827
- CLI.step(1, steps, 'Prune Docker images and volumes')
828
809
  # self.docker(f'builder prune')
829
810
  self.docker(f'system prune --volumes --force')
830
811
  # self.docker(f'container prune')
@@ -834,14 +815,6 @@ class DefaultManager(object):
834
815
  CLI.info('Reloading webserver...')
835
816
  self.docker(f'exec -it {self.CONTAINER_WEBSERVER} {self.WEBSERVER} -s reload')
836
817
 
837
- # TODO: Extension
838
- # def restart_proxy(self):
839
- # CLI.info('Restarting proxy...')
840
- # steps = 1
841
- #
842
- # CLI.step(1, steps, 'Reloading proxy container...')
843
- # self.cmd(f'{self.docker_connection} docker compose -f configs/{self.configs_compose_folder}/docker-compose.proxy.yml --project-name=reverse up -d')
844
-
845
818
  def status(self):
846
819
  CLI.info('Getting status...')
847
820
  steps = 2
@@ -854,9 +827,7 @@ class DefaultManager(object):
854
827
 
855
828
  def networks(self):
856
829
  CLI.info('Getting networks...')
857
- steps = 1
858
-
859
- CLI.step(1, steps, 'List of Docker networks')
830
+ CLI.warning('List of Docker networks')
860
831
 
861
832
  networks = self.docker('network ls', return_output=True)
862
833
  networks = networks.strip().split('\n')
@@ -901,7 +872,7 @@ class DefaultManager(object):
901
872
  containers = self.docker(f'container ls -a --format \'{{{{.Names}}}}\'', return_output=True)
902
873
  print(containers)
903
874
  containers = containers.strip().split('\n')
904
- containers = list(filter(lambda x: x.startswith(self.CONTAINER_PREFIX), containers))
875
+ # containers = list(filter(lambda x: x.startswith(self.CONTAINER_PREFIX), containers))
905
876
  return containers
906
877
 
907
878
  def get_containers_starting_with(self, start_with):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: mantis-cli
3
- Version: 9.0.1
3
+ Version: 9.0.2
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -1 +0,0 @@
1
- VERSION = '9.0.1'
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