From 96589dd840e6085ece540d36ec1e9cc4314a4614 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Fri, 8 Dec 2017 14:01:00 -0600 Subject: [PATCH 01/18] Use a new default target --- installer/DESIGN.md | 4 +- installer/build/ova-manifest.json | 603 +++++++++--------- .../build/scripts/admiral/admiral.service | 21 + .../scripts/{systemd => appliance}/boot.local | 0 .../{systemd => appliance}/dcui_override.conf | 0 .../appliance/load-docker-images.sh | 2 + .../mounts}/repartition.service | 2 +- .../mounts}/resizefs.service | 3 +- .../mounts/storage-data.mount | 4 +- .../mounts/storage-db.mount | 2 +- .../mounts/storage-log.mount | 2 +- .../appliance/mounts/vic-mounts.target | 8 + .../network/network-config.sh | 0 .../network}/ova-firewall.service | 2 +- .../network}/ova-firewall.sh | 0 .../network/ovf-network.service | 2 +- .../psc/get_token.service | 5 +- .../scripts/{ => appliance}/psc/get_token.sh | 6 +- .../psc/get_token.timer | 0 .../scripts/appliance/psc/psc-ready.target | 9 + .../psc/vic-appliance-wait-psc-config.service | 12 + .../{systemd => appliance}/resize_volume.sh | 0 .../scripts/{ => appliance}/set_guestinfo.sh | 0 .../appliance/sshd_permitrootlogin.service | 2 +- .../appliance/sshd_permitrootlogin.sh | 0 .../{systemd => appliance}/toolbox.service | 2 +- .../vic-appliance-environment.service | 4 +- .../appliance/vic-appliance-environment.sh | 0 .../vic-appliance-load-docker-images.service | 6 +- .../vic-appliance.target} | 12 +- .../build/scripts/appliance/wait_for_file.sh | 10 + .../fileserver/fileserver.service | 9 +- installer/build/scripts/harbor/harbor.service | 22 + .../build/scripts/harbor/upgrade_from_0.5.sh | 1 - .../filesystem_provisioning.sh | 0 .../package_provisioning.sh | 0 .../{ => provisioners}/provision_admiral.sh | 0 .../provision_fileserver.sh | 0 .../{ => provisioners}/provision_harbor.sh | 0 .../{ => provisioners}/system_settings.sh | 18 +- .../scripts/systemd/admiral/admiral.service | 16 - .../admiral/admiral_default_users.service | 12 - .../systemd/admiral/admiral_startup.path | 9 - .../systemd/admiral/admiral_startup.service | 15 - .../vic-appliance-docker-images-loaded.path | 10 - .../build/scripts/systemd/docker.service | 33 - .../fileserver/fileserver_startup.service | 13 - .../scripts/systemd/harbor/harbor.service | 16 - .../systemd/harbor/harbor_startup.path | 9 - .../systemd/harbor/harbor_startup.service | 14 - .../scripts/systemd/mounts/vic-mounts.target | 8 - .../scripts/systemd/vic-appliance.target | 8 - .../build/scripts/upgrade/upgrade-admiral.sh | 2 +- .../build/scripts/upgrade/upgrade-harbor.sh | 5 +- installer/build/scripts/upgrade/upgrade.sh | 16 +- .../configure_vic_machine_server.sh | 0 .../vic-machine-server-logrotate | 0 .../vic_machine_server.service | 8 +- 58 files changed, 428 insertions(+), 539 deletions(-) create mode 100644 installer/build/scripts/admiral/admiral.service rename installer/build/scripts/{systemd => appliance}/boot.local (100%) rename installer/build/scripts/{systemd => appliance}/dcui_override.conf (100%) rename installer/build/scripts/{systemd => }/appliance/load-docker-images.sh (98%) rename installer/build/scripts/{systemd => appliance/mounts}/repartition.service (96%) rename installer/build/scripts/{systemd => appliance/mounts}/resizefs.service (87%) rename installer/build/scripts/{systemd => appliance}/mounts/storage-data.mount (85%) rename installer/build/scripts/{systemd => appliance}/mounts/storage-db.mount (90%) rename installer/build/scripts/{systemd => appliance}/mounts/storage-log.mount (90%) create mode 100644 installer/build/scripts/appliance/mounts/vic-mounts.target rename installer/build/scripts/{systemd => appliance}/network/network-config.sh (100%) rename installer/build/scripts/{systemd/appliance => appliance/network}/ova-firewall.service (80%) rename installer/build/scripts/{systemd/appliance => appliance/network}/ova-firewall.sh (100%) rename installer/build/scripts/{systemd => appliance}/network/ovf-network.service (86%) rename installer/build/scripts/{systemd => appliance}/psc/get_token.service (60%) rename installer/build/scripts/{ => appliance}/psc/get_token.sh (90%) rename installer/build/scripts/{systemd => appliance}/psc/get_token.timer (100%) create mode 100644 installer/build/scripts/appliance/psc/psc-ready.target create mode 100644 installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service rename installer/build/scripts/{systemd => appliance}/resize_volume.sh (100%) rename installer/build/scripts/{ => appliance}/set_guestinfo.sh (100%) rename installer/build/scripts/{systemd => }/appliance/sshd_permitrootlogin.service (85%) rename installer/build/scripts/{systemd => }/appliance/sshd_permitrootlogin.sh (100%) rename installer/build/scripts/{systemd => appliance}/toolbox.service (89%) rename installer/build/scripts/{systemd => }/appliance/vic-appliance-environment.service (71%) rename installer/build/scripts/{systemd => }/appliance/vic-appliance-environment.sh (100%) rename installer/build/scripts/{systemd => }/appliance/vic-appliance-load-docker-images.service (53%) rename installer/build/scripts/{systemd/vic-appliance-ready.target => appliance/vic-appliance.target} (64%) create mode 100755 installer/build/scripts/appliance/wait_for_file.sh rename installer/build/scripts/{systemd => }/fileserver/fileserver.service (53%) create mode 100644 installer/build/scripts/harbor/harbor.service rename installer/build/scripts/{ => provisioners}/filesystem_provisioning.sh (100%) rename installer/build/scripts/{ => provisioners}/package_provisioning.sh (100%) rename installer/build/scripts/{ => provisioners}/provision_admiral.sh (100%) rename installer/build/scripts/{ => provisioners}/provision_fileserver.sh (100%) rename installer/build/scripts/{ => provisioners}/provision_harbor.sh (100%) rename installer/build/scripts/{ => provisioners}/system_settings.sh (88%) delete mode 100644 installer/build/scripts/systemd/admiral/admiral.service delete mode 100644 installer/build/scripts/systemd/admiral/admiral_default_users.service delete mode 100644 installer/build/scripts/systemd/admiral/admiral_startup.path delete mode 100644 installer/build/scripts/systemd/admiral/admiral_startup.service delete mode 100644 installer/build/scripts/systemd/appliance/vic-appliance-docker-images-loaded.path delete mode 100644 installer/build/scripts/systemd/docker.service delete mode 100644 installer/build/scripts/systemd/fileserver/fileserver_startup.service delete mode 100644 installer/build/scripts/systemd/harbor/harbor.service delete mode 100644 installer/build/scripts/systemd/harbor/harbor_startup.path delete mode 100644 installer/build/scripts/systemd/harbor/harbor_startup.service delete mode 100644 installer/build/scripts/systemd/mounts/vic-mounts.target delete mode 100644 installer/build/scripts/systemd/vic-appliance.target rename installer/build/scripts/{systemd => }/vic_machine_server/configure_vic_machine_server.sh (100%) rename installer/build/scripts/{systemd => }/vic_machine_server/vic-machine-server-logrotate (100%) rename installer/build/scripts/{systemd => }/vic_machine_server/vic_machine_server.service (85%) diff --git a/installer/DESIGN.md b/installer/DESIGN.md index a48c74e5e3..dd775b74b3 100644 --- a/installer/DESIGN.md +++ b/installer/DESIGN.md @@ -55,8 +55,8 @@ _TODO_ Add reference service to repo This allows the component to specify the startup and shutdown behavior through unit dependency directives such as `Wants`, `Requires`, `Before`, and `After`. -- A component unit file MUST have a `Requires=vic-appliance-ready.service` and - `After=vic-appliance-ready.service` statement +- A component unit file MUST have a `Requires=vic-appliance.service` and + `After=vic-appliance.service` statement This target ensures that the prerequisites for component services including disk, network, firewall, and Docker are ready before the component starts. diff --git a/installer/build/ova-manifest.json b/installer/build/ova-manifest.json index a38d1e2088..00074a3a5c 100644 --- a/installer/build/ova-manifest.json +++ b/installer/build/ova-manifest.json @@ -1,321 +1,286 @@ [ - { - "type": "shell", - "script": "scripts/package_provisioning.sh" - }, - { - "type": "shell", - "script": "scripts/filesystem_provisioning.sh" - }, - { - "type": "file", - "source": "../bin/ovfenv", - "destination": "/usr/bin/ovfenv" - }, - { - "type": "file", - "source": "../bin/vic-ova-ui", - "destination": "/usr/bin/vic-ova-ui" - }, - { - "type": "file", - "source": "../bin/ova-webserver", - "destination": "/usr/local/bin/ova-webserver" - }, - { - "type": "file", - "source": "../bin/toolbox", - "destination": "/usr/bin/toolbox" - }, - { - "type": "file", - "source": "../bin/rpctool", - "destination": "/usr/bin/rpctool" - }, - { - "type": "file", - "source": "scripts/systemd/boot.local", - "destination": "/etc/rc.d/init.d/boot.local" - }, - { - "type": "file", - "source": "scripts/systemd/resize_volume.sh", - "destination": "/etc/vmware/resize_volume.sh" - }, - { - "type": "file", - "source": "scripts/systemd/mounts/vic-mounts.target", - "destination": "/usr/lib/systemd/system/vic-mounts.target" - }, - { - "type": "file", - "source": "scripts/systemd/mounts/storage-data.mount", - "destination": "/usr/lib/systemd/system/storage-data.mount" - }, - { - "type": "file", - "source": "scripts/systemd/mounts/storage-db.mount", - "destination": "/usr/lib/systemd/system/storage-db.mount" - }, - { - "type": "file", - "source": "scripts/systemd/mounts/storage-log.mount", - "destination": "/usr/lib/systemd/system/storage-log.mount" - }, - { - "type": "file", - "source": "scripts/systemd/repartition.service", - "destination": "/usr/lib/systemd/system/repartition.service" - }, - { - "type": "file", - "source": "scripts/systemd/resizefs.service", - "destination": "/usr/lib/systemd/system/resizefs.service" - }, - { - "type": "file", - "source": "scripts/systemd/dcui_override.conf", - "destination": "/usr/lib/systemd/system/getty@tty2.service.d/dcui_override.conf" - }, - { - "type": "file", - "source": "scripts/systemd/vic-appliance.target", - "destination": "/usr/lib/systemd/system/vic-appliance.target" - }, - { - "type": "file", - "source": "scripts/systemd/vic-appliance-ready.target", - "destination": "/usr/lib/systemd/system/vic-appliance-ready.target" - }, - { - "type": "file", - "source": "scripts/systemd/network/ovf-network.service", - "destination": "/usr/lib/systemd/system/ovf-network.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/vic-appliance-load-docker-images.service", - "destination": "/usr/lib/systemd/system/vic-appliance-load-docker-images.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/vic-appliance-docker-images-loaded.path", - "destination": "/usr/lib/systemd/system/vic-appliance-docker-images-loaded.path" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/load-docker-images.sh", - "destination": "/etc/vmware/load-docker-images.sh" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/vic-appliance-environment.service", - "destination": "/usr/lib/systemd/system/vic-appliance-environment.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/vic-appliance-environment.sh", - "destination": "/etc/vmware/vic-appliance-environment.sh" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/sshd_permitrootlogin.service", - "destination": "/usr/lib/systemd/system/sshd_permitrootlogin.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/sshd_permitrootlogin.sh", - "destination": "/etc/vmware/sshd_permitrootlogin.sh" - }, - { - "type": "file", - "source": "scripts/systemd/toolbox.service", - "destination": "/usr/lib/systemd/system/toolbox.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/ova-firewall.service", - "destination": "/usr/lib/systemd/system/ova-firewall.service" - }, - { - "type": "file", - "source": "scripts/systemd/appliance/ova-firewall.sh", - "destination": "/etc/vmware/ova-firewall.sh" - }, - { - "type": "file", - "source": "scripts/systemd/network/network-config.sh", - "destination": "/etc/vmware/network-config.sh" - }, - { - "type": "file", - "source": "scripts/systemd/vic_machine_server/vic_machine_server.service", - "destination": "/usr/lib/systemd/system/vic_machine_server.service" - }, - { - "type": "file", - "source": "scripts/systemd/vic_machine_server/configure_vic_machine_server.sh", - "destination": "/etc/vmware/vic_machine_server/configure_vic_machine_server.sh" - }, - { - "type": "file", - "source": "scripts/systemd/vic_machine_server/vic-machine-server-logrotate", - "destination": "/etc/logrotate.d/vic-machine-server" - }, - { - "type": "file", - "source": "scripts/systemd/harbor/harbor_startup.service", - "destination": "/usr/lib/systemd/system/harbor_startup.service" - }, - { - "type": "file", - "source": "scripts/systemd/harbor/harbor_startup.path", - "destination": "/usr/lib/systemd/system/harbor_startup.path" - }, - { - "type": "file", - "source": "scripts/systemd/harbor/harbor.service", - "destination": "/usr/lib/systemd/system/harbor.service" - }, - { - "type": "shell", - "script": "scripts/provision_harbor.sh" - }, - { - "type": "file", - "source": "scripts/set_guestinfo.sh", - "destination": "/etc/vmware/set_guestinfo.sh" - }, - { - "type": "file", - "source": "scripts/harbor/configure_harbor.sh", - "destination": "/etc/vmware/harbor/configure_harbor.sh" - }, - { - "type": "file", - "source": "scripts/harbor/start_harbor.sh", - "destination": "/etc/vmware/harbor/start_harbor.sh" - }, - { - "type": "file", - "source": "scripts/upgrade/upgrade.sh", - "destination": "/etc/vmware/upgrade/upgrade.sh" - }, - { - "type": "file", - "source": "scripts/upgrade/upgrade-admiral.sh", - "destination": "/etc/vmware/upgrade/upgrade-admiral.sh" - }, - { - "type": "file", - "source": "scripts/upgrade/upgrade-harbor.sh", - "destination": "/etc/vmware/upgrade/upgrade-harbor.sh" - }, - { - "type": "file", - "source": "scripts/upgrade/util.sh", - "destination": "/etc/vmware/upgrade/util.sh" - }, - { - "type": "file", - "source": "scripts/appliance/get_vic_appliance_logs.sh", - "destination": "/etc/vmware/support/get_vic_appliance_logs.sh" - }, - { - "type": "shell", - "script": "scripts/provision_admiral.sh" - }, - { - "type": "file", - "source": "scripts/systemd/admiral/admiral_startup.service", - "destination": "/usr/lib/systemd/system/admiral_startup.service" - }, - { - "type": "file", - "source": "scripts/systemd/admiral/admiral_startup.path", - "destination": "/usr/lib/systemd/system/admiral_startup.path" - }, - { - "type": "file", - "source": "scripts/systemd/admiral/admiral.service", - "destination": "/usr/lib/systemd/system/admiral.service" - }, - { - "type": "file", - "source": "scripts/systemd/admiral/admiral_default_users.service", - "destination": "/usr/lib/systemd/system/admiral_default_users.service" - }, - { - "type": "file", - "source": "scripts/admiral/configure_admiral.sh", - "destination": "/etc/vmware/admiral/configure_admiral.sh" - }, - { - "type": "file", - "source": "scripts/admiral/start_admiral.sh", - "destination": "/etc/vmware/admiral/start_admiral.sh" - }, - { - "type": "file", - "source": "scripts/admiral/add_default_users.sh", - "destination": "/etc/vmware/admiral/add_default_users.sh" - }, - { - "type": "file", - "source": "scripts/admiral/logging-vic.properties", - "destination": "/etc/vmware/admiral/logging-vic.properties" - }, - { - "type": "file", - "source": "scripts/systemd/psc/get_token.service", - "destination": "/usr/lib/systemd/system/get_token.service" - }, - { - "type": "file", - "source": "scripts/psc/get_token.sh", - "destination": "/etc/vmware/psc/get_token.sh" - }, - { - "type": "file", - "source": "scripts/systemd/psc/get_token.timer", - "destination": "/usr/lib/systemd/system/get_token.timer" - }, - { - "type": "shell", - "script": "scripts/provision_fileserver.sh" - }, - { - "type": "file", - "source": "scripts/systemd/fileserver/fileserver_startup.service", - "destination": "/usr/lib/systemd/system/fileserver_startup.service" - }, - { - "type": "file", - "source": "scripts/systemd/fileserver/fileserver.service", - "destination": "/usr/lib/systemd/system/fileserver.service" - }, - { - "type": "file", - "source": "scripts/fileserver/configure_fileserver.sh", - "destination": "/etc/vmware/fileserver/configure_fileserver.sh" - }, - { - "type": "file", - "source": "scripts/fileserver/start_fileserver.sh", - "destination": "/etc/vmware/fileserver/start_fileserver.sh" - }, - { - "type": "file", - "source": "../fileserver/html", - "destination": "/opt/vmware/fileserver/html" - }, - { - "type": "file", - "source": "../fileserver/files/open_source_license.txt", - "destination": "/opt/vmware/fileserver/files/open_source_license.txt" - }, - { - "type": "shell", - "script": "scripts/system_settings.sh" - } + { + "type": "shell", + "script": "scripts/provisioners/package_provisioning.sh" + }, + { + "type": "shell", + "script": "scripts/provisioners/filesystem_provisioning.sh" + }, + { + "type": "file", + "source": "../bin/ovfenv", + "destination": "/usr/bin/ovfenv" + }, + { + "type": "file", + "source": "../bin/vic-ova-ui", + "destination": "/usr/bin/vic-ova-ui" + }, + { + "type": "file", + "source": "../bin/ova-webserver", + "destination": "/usr/local/bin/ova-webserver" + }, + { + "type": "file", + "source": "../bin/toolbox", + "destination": "/usr/bin/toolbox" + }, + { + "type": "file", + "source": "../bin/rpctool", + "destination": "/usr/bin/rpctool" + }, + { + "type": "file", + "source": "scripts/appliance/boot.local", + "destination": "/etc/rc.d/init.d/boot.local" + }, + { + "type": "file", + "source": "scripts/appliance/wait_for_file.sh", + "destination": "/etc/vmware/wait_for_file.sh" + }, + { + "type": "file", + "source": "scripts/appliance/resize_volume.sh", + "destination": "/etc/vmware/resize_volume.sh" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/vic-mounts.target", + "destination": "/usr/lib/systemd/system/vic-mounts.target" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/storage-data.mount", + "destination": "/usr/lib/systemd/system/storage-data.mount" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/storage-db.mount", + "destination": "/usr/lib/systemd/system/storage-db.mount" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/storage-log.mount", + "destination": "/usr/lib/systemd/system/storage-log.mount" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/repartition.service", + "destination": "/usr/lib/systemd/system/repartition.service" + }, + { + "type": "file", + "source": "scripts/appliance/mounts/resizefs.service", + "destination": "/usr/lib/systemd/system/resizefs.service" + }, + { + "type": "file", + "source": "scripts/appliance/dcui_override.conf", + "destination": "/usr/lib/systemd/system/getty@tty2.service.d/dcui_override.conf" + }, + { + "type": "file", + "source": "scripts/appliance/vic-appliance.target", + "destination": "/usr/lib/systemd/system/vic-appliance.target" + }, + { + "type": "file", + "source": "scripts/appliance/network/ovf-network.service", + "destination": "/usr/lib/systemd/system/ovf-network.service" + }, + { + "type": "file", + "source": "scripts/appliance/vic-appliance-load-docker-images.service", + "destination": "/usr/lib/systemd/system/vic-appliance-load-docker-images.service" + }, + { + "type": "file", + "source": "scripts/appliance/load-docker-images.sh", + "destination": "/etc/vmware/load-docker-images.sh" + }, + { + "type": "file", + "source": "scripts/appliance/vic-appliance-environment.service", + "destination": "/usr/lib/systemd/system/vic-appliance-environment.service" + }, + { + "type": "file", + "source": "scripts/appliance/vic-appliance-environment.sh", + "destination": "/etc/vmware/vic-appliance-environment.sh" + }, + { + "type": "file", + "source": "scripts/appliance/sshd_permitrootlogin.service", + "destination": "/usr/lib/systemd/system/sshd_permitrootlogin.service" + }, + { + "type": "file", + "source": "scripts/appliance/sshd_permitrootlogin.sh", + "destination": "/etc/vmware/sshd_permitrootlogin.sh" + }, + { + "type": "file", + "source": "scripts/appliance/toolbox.service", + "destination": "/usr/lib/systemd/system/toolbox.service" + }, + { + "type": "file", + "source": "scripts/appliance/network/ova-firewall.service", + "destination": "/usr/lib/systemd/system/ova-firewall.service" + }, + { + "type": "file", + "source": "scripts/appliance/network/ova-firewall.sh", + "destination": "/etc/vmware/ova-firewall.sh" + }, + { + "type": "file", + "source": "scripts/appliance/network/network-config.sh", + "destination": "/etc/vmware/network-config.sh" + }, + { + "type": "file", + "source": "scripts/vic_machine_server/vic_machine_server.service", + "destination": "/usr/lib/systemd/system/vic_machine_server.service" + }, + { + "type": "file", + "source": "scripts/vic_machine_server/configure_vic_machine_server.sh", + "destination": "/etc/vmware/vic_machine_server/configure_vic_machine_server.sh" + }, + { + "type": "file", + "source": "scripts/vic_machine_server/vic-machine-server-logrotate", + "destination": "/etc/logrotate.d/vic-machine-server" + }, + { + "type": "file", + "source": "scripts/harbor/harbor.service", + "destination": "/usr/lib/systemd/system/harbor.service" + }, + { + "type": "shell", + "script": "scripts/provisioners/provision_harbor.sh" + }, + { + "type": "file", + "source": "scripts/appliance/set_guestinfo.sh", + "destination": "/etc/vmware/set_guestinfo.sh" + }, + { + "type": "file", + "source": "scripts/harbor/configure_harbor.sh", + "destination": "/etc/vmware/harbor/configure_harbor.sh" + }, + { + "type": "file", + "source": "scripts/harbor/start_harbor.sh", + "destination": "/etc/vmware/harbor/start_harbor.sh" + }, + { + "type": "file", + "source": "scripts/upgrade/upgrade.sh", + "destination": "/etc/vmware/upgrade/upgrade.sh" + }, + { + "type": "file", + "source": "scripts/upgrade/upgrade-admiral.sh", + "destination": "/etc/vmware/upgrade/upgrade-admiral.sh" + }, + { + "type": "file", + "source": "scripts/upgrade/upgrade-harbor.sh", + "destination": "/etc/vmware/upgrade/upgrade-harbor.sh" + }, + { + "type": "file", + "source": "scripts/upgrade/util.sh", + "destination": "/etc/vmware/upgrade/util.sh" + }, + { + "type": "file", + "source": "scripts/appliance/get_vic_appliance_logs.sh", + "destination": "/etc/vmware/support/get_vic_appliance_logs.sh" + }, + { + "type": "shell", + "script": "scripts/provisioners/provision_admiral.sh" + }, + { + "type": "file", + "source": "scripts/admiral/admiral.service", + "destination": "/usr/lib/systemd/system/admiral.service" + }, + { + "type": "file", + "source": "scripts/admiral/configure_admiral.sh", + "destination": "/etc/vmware/admiral/configure_admiral.sh" + }, + { + "type": "file", + "source": "scripts/admiral/start_admiral.sh", + "destination": "/etc/vmware/admiral/start_admiral.sh" + }, + { + "type": "file", + "source": "scripts/admiral/add_default_users.sh", + "destination": "/etc/vmware/admiral/add_default_users.sh" + }, + { + "type": "file", + "source": "scripts/admiral/logging-vic.properties", + "destination": "/etc/vmware/admiral/logging-vic.properties" + }, + { + "type": "file", + "source": "scripts/appliance/psc/get_token.service", + "destination": "/usr/lib/systemd/system/get_token.service" + }, + { + "type": "file", + "source": "scripts/appliance/psc/get_token.sh", + "destination": "/etc/vmware/psc/get_token.sh" + }, + { + "type": "file", + "source": "scripts/appliance/psc/get_token.timer", + "destination": "/usr/lib/systemd/system/get_token.timer" + }, + { + "type": "shell", + "script": "scripts/provisioners/provision_fileserver.sh" + }, + { + "type": "file", + "source": "scripts/fileserver/fileserver.service", + "destination": "/usr/lib/systemd/system/fileserver.service" + }, + { + "type": "file", + "source": "scripts/fileserver/configure_fileserver.sh", + "destination": "/etc/vmware/fileserver/configure_fileserver.sh" + }, + { + "type": "file", + "source": "scripts/fileserver/start_fileserver.sh", + "destination": "/etc/vmware/fileserver/start_fileserver.sh" + }, + { + "type": "file", + "source": "../fileserver/html", + "destination": "/opt/vmware/fileserver/html" + }, + { + "type": "file", + "source": "../fileserver/files/open_source_license.txt", + "destination": "/opt/vmware/fileserver/files/open_source_license.txt" + }, + { + "type": "scripts/provisioners", + "script": "scripts/system_settings.sh" + } ] diff --git a/installer/build/scripts/admiral/admiral.service b/installer/build/scripts/admiral/admiral.service new file mode 100644 index 0000000000..8063806a83 --- /dev/null +++ b/installer/build/scripts/admiral/admiral.service @@ -0,0 +1,21 @@ +[Unit] +Description=Admiral is a highly scalable and very lightweight Container Management platform for deploying and managing container based applications. +Documentation=https://github.com/vmware/admiral +After=vic-appliance-ready.target psc-ready.target +Requires=vic-appliance-ready.target psc-ready.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=15 +TimeoutSec=infinity +ExecStartPre=-/usr/bin/docker stop vic-admiral &> /dev/null +ExecStartPre=-/usr/bin/docker rm vic-admiral &> /dev/null +ExecStartPre=/usr/bin/bash /etc/vmware/admiral/configure_admiral.sh +ExecStart=/etc/vmware/admiral/start_admiral.sh +ExecStartPost=/usr/bin/bash /etc/vmware/admiral/add_default_users.sh +ExecStop=/usr/bin/docker stop vic-admiral +ExecStopPost=/usr/bin/docker rm vic-admiral + +[Install] +WantedBy=vic-appliance.target \ No newline at end of file diff --git a/installer/build/scripts/systemd/boot.local b/installer/build/scripts/appliance/boot.local similarity index 100% rename from installer/build/scripts/systemd/boot.local rename to installer/build/scripts/appliance/boot.local diff --git a/installer/build/scripts/systemd/dcui_override.conf b/installer/build/scripts/appliance/dcui_override.conf similarity index 100% rename from installer/build/scripts/systemd/dcui_override.conf rename to installer/build/scripts/appliance/dcui_override.conf diff --git a/installer/build/scripts/systemd/appliance/load-docker-images.sh b/installer/build/scripts/appliance/load-docker-images.sh similarity index 98% rename from installer/build/scripts/systemd/appliance/load-docker-images.sh rename to installer/build/scripts/appliance/load-docker-images.sh index 0f70c37e75..d546f17be1 100755 --- a/installer/build/scripts/systemd/appliance/load-docker-images.sh +++ b/installer/build/scripts/appliance/load-docker-images.sh @@ -58,6 +58,8 @@ if [[ ! -f /etc/vmware/firstboot ]]; then echo "vic-machine-server=${VIC_MACHINE_SERVER_IMAGE} ${VIC_MACHINE_SERVER_IMAGE_ID}" >> /storage/data/version echo "vic-machine-server=${VIC_MACHINE_SERVER_IMAGE} ${VIC_MACHINE_SERVER_IMAGE_ID}" >> /etc/vmware/version date -u +"%Y-%m-%dT%H:%M:%SZ" > /etc/vmware/firstboot +else + echo "No images to load...." fi # We then obscure the root password, if the VM is reconfigured with another diff --git a/installer/build/scripts/systemd/repartition.service b/installer/build/scripts/appliance/mounts/repartition.service similarity index 96% rename from installer/build/scripts/systemd/repartition.service rename to installer/build/scripts/appliance/mounts/repartition.service index dcdce3835c..681e773c6c 100644 --- a/installer/build/scripts/systemd/repartition.service +++ b/installer/build/scripts/appliance/mounts/repartition.service @@ -12,4 +12,4 @@ ExecStart=/etc/vmware/resize_volume.sh repartition /dev/sdc 1 ExecStart=/etc/vmware/resize_volume.sh repartition /dev/sdd 1 [Install] -WantedBy=resizefs.service +RequiredBy=vic-mounts.target diff --git a/installer/build/scripts/systemd/resizefs.service b/installer/build/scripts/appliance/mounts/resizefs.service similarity index 87% rename from installer/build/scripts/systemd/resizefs.service rename to installer/build/scripts/appliance/mounts/resizefs.service index 9e0dc6c552..cd289876b5 100644 --- a/installer/build/scripts/systemd/resizefs.service +++ b/installer/build/scripts/appliance/mounts/resizefs.service @@ -2,7 +2,6 @@ Description=Resize data partitions Wants=repartition.service After=repartition.service -Before=vic-mounts.target [Service] Type=oneshot @@ -12,4 +11,4 @@ ExecStart=/etc/vmware/resize_volume.sh resize /dev/sdc 1 ExecStart=/etc/vmware/resize_volume.sh resize /dev/sdd 1 [Install] -WantedBy=vic-mounts.target \ No newline at end of file +RequiredBy=vic-mounts.target \ No newline at end of file diff --git a/installer/build/scripts/systemd/mounts/storage-data.mount b/installer/build/scripts/appliance/mounts/storage-data.mount similarity index 85% rename from installer/build/scripts/systemd/mounts/storage-data.mount rename to installer/build/scripts/appliance/mounts/storage-data.mount index dfc1afc21d..93f3a7ad39 100644 --- a/installer/build/scripts/systemd/mounts/storage-data.mount +++ b/installer/build/scripts/appliance/mounts/storage-data.mount @@ -9,5 +9,5 @@ What=/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1 Where=/storage/data Type=ext4 -[Install] -RequiredBy=local-fs.target +[Install] +RequiredBy=vic-mounts.target diff --git a/installer/build/scripts/systemd/mounts/storage-db.mount b/installer/build/scripts/appliance/mounts/storage-db.mount similarity index 90% rename from installer/build/scripts/systemd/mounts/storage-db.mount rename to installer/build/scripts/appliance/mounts/storage-db.mount index 5838336b09..0490c5bdde 100644 --- a/installer/build/scripts/systemd/mounts/storage-db.mount +++ b/installer/build/scripts/appliance/mounts/storage-db.mount @@ -10,4 +10,4 @@ Where=/storage/db Type=ext4 [Install] -RequiredBy=local-fs.target +RequiredBy=vic-mounts.target \ No newline at end of file diff --git a/installer/build/scripts/systemd/mounts/storage-log.mount b/installer/build/scripts/appliance/mounts/storage-log.mount similarity index 90% rename from installer/build/scripts/systemd/mounts/storage-log.mount rename to installer/build/scripts/appliance/mounts/storage-log.mount index 73a4960747..e3a9f4056f 100644 --- a/installer/build/scripts/systemd/mounts/storage-log.mount +++ b/installer/build/scripts/appliance/mounts/storage-log.mount @@ -10,4 +10,4 @@ Where=/storage/log Type=ext4 [Install] -RequiredBy=local-fs.target +RequiredBy=vic-mounts.target \ No newline at end of file diff --git a/installer/build/scripts/appliance/mounts/vic-mounts.target b/installer/build/scripts/appliance/mounts/vic-mounts.target new file mode 100644 index 0000000000..e1ee95643b --- /dev/null +++ b/installer/build/scripts/appliance/mounts/vic-mounts.target @@ -0,0 +1,8 @@ +[Unit] +Description=Disk mounts required by VIC(Integrated containers engine on vSphere) +Documentation=https://github.com/vmware/vic/blob/master/doc/bundle/OVA-spec.md +Requires=storage-data.mount storage-db.mount storage-log.mount repartition.service resizefs.service +After=storage-data.mount storage-db.mount storage-log.mount repartition.service resizefs.service + +[Install] +WantedBy=vic-appliance.target local-fs.target diff --git a/installer/build/scripts/systemd/network/network-config.sh b/installer/build/scripts/appliance/network/network-config.sh similarity index 100% rename from installer/build/scripts/systemd/network/network-config.sh rename to installer/build/scripts/appliance/network/network-config.sh diff --git a/installer/build/scripts/systemd/appliance/ova-firewall.service b/installer/build/scripts/appliance/network/ova-firewall.service similarity index 80% rename from installer/build/scripts/systemd/appliance/ova-firewall.service rename to installer/build/scripts/appliance/network/ova-firewall.service index e5c608074c..cd1c893419 100644 --- a/installer/build/scripts/systemd/appliance/ova-firewall.service +++ b/installer/build/scripts/appliance/network/ova-firewall.service @@ -1,7 +1,7 @@ [Unit] Description=configure system firewall After=network-online.target iptables.service -Requires=iptables.service +Requires=network-online.target iptables.service [Service] Type=oneshot diff --git a/installer/build/scripts/systemd/appliance/ova-firewall.sh b/installer/build/scripts/appliance/network/ova-firewall.sh similarity index 100% rename from installer/build/scripts/systemd/appliance/ova-firewall.sh rename to installer/build/scripts/appliance/network/ova-firewall.sh diff --git a/installer/build/scripts/systemd/network/ovf-network.service b/installer/build/scripts/appliance/network/ovf-network.service similarity index 86% rename from installer/build/scripts/systemd/network/ovf-network.service rename to installer/build/scripts/appliance/network/ovf-network.service index 8323e883ee..f0add0b115 100644 --- a/installer/build/scripts/systemd/network/ovf-network.service +++ b/installer/build/scripts/appliance/network/ovf-network.service @@ -8,4 +8,4 @@ Type=oneshot ExecStart=/etc/vmware/network-config.sh [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target diff --git a/installer/build/scripts/systemd/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service similarity index 60% rename from installer/build/scripts/systemd/psc/get_token.service rename to installer/build/scripts/appliance/psc/get_token.service index 3546e29989..100141160a 100644 --- a/installer/build/scripts/systemd/psc/get_token.service +++ b/installer/build/scripts/appliance/psc/get_token.service @@ -1,11 +1,12 @@ [Unit] Description=PSC Get Token Documentation=http://github.com/vmware/vic-product/installer -Before=harbor_startup.service +Requires=vic-appliance-wait-psc-config.service +After=vic-vic-appliance-wait-psc-config.service [Service] Type=oneshot ExecStart=/usr/bin/bash /etc/vmware/psc/get_token.sh [Install] -WantedBy=multi-user.target +WantedBy=psc-ready.target diff --git a/installer/build/scripts/psc/get_token.sh b/installer/build/scripts/appliance/psc/get_token.sh similarity index 90% rename from installer/build/scripts/psc/get_token.sh rename to installer/build/scripts/appliance/psc/get_token.sh index 5b70d78aec..ee409b9e35 100755 --- a/installer/build/scripts/psc/get_token.sh +++ b/installer/build/scripts/appliance/psc/get_token.sh @@ -32,5 +32,7 @@ version=$(grep "version" /etc/vmware/psc/admiral/psc-config.properties | awk -F= # Copy harbor token to container mount path mkdir -p /storage/data/harbor/psc cp /etc/vmware/psc/harbor/tokens.properties /storage/data/harbor/psc/tokens.properties -# Create path for activating harbor_startup.service to avoid its dependency on /storage/data -mkdir -p /etc/vmware/psc/harbor/harbor_startup +# Create path for activating harbor.service to avoid its dependency on /storage/data +if [ ! -d /etc/vmware/psc/harbor/harbor_startup ]; then + mkdir -p /etc/vmware/psc/harbor/harbor_startup +fi diff --git a/installer/build/scripts/systemd/psc/get_token.timer b/installer/build/scripts/appliance/psc/get_token.timer similarity index 100% rename from installer/build/scripts/systemd/psc/get_token.timer rename to installer/build/scripts/appliance/psc/get_token.timer diff --git a/installer/build/scripts/appliance/psc/psc-ready.target b/installer/build/scripts/appliance/psc/psc-ready.target new file mode 100644 index 0000000000..624a7246e3 --- /dev/null +++ b/installer/build/scripts/appliance/psc/psc-ready.target @@ -0,0 +1,9 @@ +[Unit] +Description=Provides a target for psc dependent components +Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md + +Requires=vic-appliance-wait-psc-config.service get_token.service +After=vic-vic-appliance-wait-psc-config.service get_token.service + +[Install] +WantedBy=vic-appliance.target \ No newline at end of file diff --git a/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service b/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service new file mode 100644 index 0000000000..fa147eeefe --- /dev/null +++ b/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service @@ -0,0 +1,12 @@ +[Unit] +Description=Wait for PSC token to be present. +Documentation=https://github.com/vmware/vic-product + +[Service] +Type=oneshot +TimeoutSec=infinity +RemainAfterExit=true +ExecStart=/etc/vmware/wait_for_file.sh /etc/vmware/psc/admiral/psc-config.properties + +[Install] +WantedBy=psc-ready.target diff --git a/installer/build/scripts/systemd/resize_volume.sh b/installer/build/scripts/appliance/resize_volume.sh similarity index 100% rename from installer/build/scripts/systemd/resize_volume.sh rename to installer/build/scripts/appliance/resize_volume.sh diff --git a/installer/build/scripts/set_guestinfo.sh b/installer/build/scripts/appliance/set_guestinfo.sh similarity index 100% rename from installer/build/scripts/set_guestinfo.sh rename to installer/build/scripts/appliance/set_guestinfo.sh diff --git a/installer/build/scripts/systemd/appliance/sshd_permitrootlogin.service b/installer/build/scripts/appliance/sshd_permitrootlogin.service similarity index 85% rename from installer/build/scripts/systemd/appliance/sshd_permitrootlogin.service rename to installer/build/scripts/appliance/sshd_permitrootlogin.service index cabd59289f..c390e945f7 100644 --- a/installer/build/scripts/systemd/appliance/sshd_permitrootlogin.service +++ b/installer/build/scripts/appliance/sshd_permitrootlogin.service @@ -7,4 +7,4 @@ Type=oneshot ExecStart=/etc/vmware/sshd_permitrootlogin.sh [Install] -WantedBy=vic-appliance.target +WantedBy=network-online.target diff --git a/installer/build/scripts/systemd/appliance/sshd_permitrootlogin.sh b/installer/build/scripts/appliance/sshd_permitrootlogin.sh similarity index 100% rename from installer/build/scripts/systemd/appliance/sshd_permitrootlogin.sh rename to installer/build/scripts/appliance/sshd_permitrootlogin.sh diff --git a/installer/build/scripts/systemd/toolbox.service b/installer/build/scripts/appliance/toolbox.service similarity index 89% rename from installer/build/scripts/systemd/toolbox.service rename to installer/build/scripts/appliance/toolbox.service index 4e7f90ef91..ec55a702a7 100644 --- a/installer/build/scripts/systemd/toolbox.service +++ b/installer/build/scripts/appliance/toolbox.service @@ -10,4 +10,4 @@ Type=notify TimeoutSec=10min [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target diff --git a/installer/build/scripts/systemd/appliance/vic-appliance-environment.service b/installer/build/scripts/appliance/vic-appliance-environment.service similarity index 71% rename from installer/build/scripts/systemd/appliance/vic-appliance-environment.service rename to installer/build/scripts/appliance/vic-appliance-environment.service index 16e6133635..593a68afb0 100644 --- a/installer/build/scripts/systemd/appliance/vic-appliance-environment.service +++ b/installer/build/scripts/appliance/vic-appliance-environment.service @@ -1,8 +1,6 @@ [Unit] Description=VIC Appliance Environment Documentation=https://github.com/vmware/vic-product -After=vic-appliance.target -Requires=vic-appliance.target [Service] Type=simple @@ -11,4 +9,4 @@ RestartSec=5 ExecStart=/etc/vmware/vic-appliance-environment.sh [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target diff --git a/installer/build/scripts/systemd/appliance/vic-appliance-environment.sh b/installer/build/scripts/appliance/vic-appliance-environment.sh similarity index 100% rename from installer/build/scripts/systemd/appliance/vic-appliance-environment.sh rename to installer/build/scripts/appliance/vic-appliance-environment.sh diff --git a/installer/build/scripts/systemd/appliance/vic-appliance-load-docker-images.service b/installer/build/scripts/appliance/vic-appliance-load-docker-images.service similarity index 53% rename from installer/build/scripts/systemd/appliance/vic-appliance-load-docker-images.service rename to installer/build/scripts/appliance/vic-appliance-load-docker-images.service index 4936e0df70..74d4a92a76 100644 --- a/installer/build/scripts/systemd/appliance/vic-appliance-load-docker-images.service +++ b/installer/build/scripts/appliance/vic-appliance-load-docker-images.service @@ -1,10 +1,12 @@ [Unit] Description=Load Cached Docker Images -After=vic-mounts.target docker.service -Requires=vic-mounts.target docker.service +After=vic-mounts.target resizefs.service docker.service +Requires=vic-mounts.target resizefs.service docker.service [Service] Type=oneshot +# allow other services to view this services as 'running' after exit +RemainAfterExit=yes ExecStart=/etc/vmware/load-docker-images.sh ExecStartPost=/usr/bin/systemctl disable vic-appliance-load-docker-images.service diff --git a/installer/build/scripts/systemd/vic-appliance-ready.target b/installer/build/scripts/appliance/vic-appliance.target similarity index 64% rename from installer/build/scripts/systemd/vic-appliance-ready.target rename to installer/build/scripts/appliance/vic-appliance.target index 781ca0640e..22fb24d0e4 100644 --- a/installer/build/scripts/systemd/vic-appliance-ready.target +++ b/installer/build/scripts/appliance/vic-appliance.target @@ -2,14 +2,14 @@ Description=System customization for VIC Appliance Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md -Requires=vic-appliance.target vic-appliance-environment.service -After=vic-appliance.target vic-appliance-environment.service - -Requires=ovf-network.service ova-firewall.service -After=ovf-network.service ova-firewall.service +Requires=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service +After=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service Requires=network-online.target systemd-resolved.service systemd-timesyncd.service After=network-online.target systemd-resolved.service systemd-timesyncd.service +Requires=ovf-network.service ova-firewall.service +After=ovf-network.service ova-firewall.service + [Install] -WantedBy=multi-user.target +Wants=multi-user.target diff --git a/installer/build/scripts/appliance/wait_for_file.sh b/installer/build/scripts/appliance/wait_for_file.sh new file mode 100755 index 0000000000..52b16bdff7 --- /dev/null +++ b/installer/build/scripts/appliance/wait_for_file.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Use with a systemd serviceType=oneshot RemainAfterExit=yes + +file=$1 +intervalInSeconds=60 # 1 minute +while [[ ! -e $file ]]; do + echo "File $file does not yet exist. sleeping $intervalInSeconds seconds..." + sleep $intervalInSeconds +done \ No newline at end of file diff --git a/installer/build/scripts/systemd/fileserver/fileserver.service b/installer/build/scripts/fileserver/fileserver.service similarity index 53% rename from installer/build/scripts/systemd/fileserver/fileserver.service rename to installer/build/scripts/fileserver/fileserver.service index 80b755c6bf..03da1fb926 100644 --- a/installer/build/scripts/systemd/fileserver/fileserver.service +++ b/installer/build/scripts/fileserver/fileserver.service @@ -1,14 +1,15 @@ [Unit] Description=VIC Unified Installer Web Server Documentation=https://github.com/vmware/vic -After=vic-appliance-ready.target fileserver_startup.service -Requires=vic-appliance-ready.target +After=vic-appliance.target +Requires=vic-appliance.target [Service] Type=simple Restart=on-failure -RestartSec=5 +RestartSec=15 +ExecStartPre=/usr/bin/bash /etc/vmware/fileserver/configure_fileserver.sh ExecStart=/etc/vmware/fileserver/start_fileserver.sh [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target \ No newline at end of file diff --git a/installer/build/scripts/harbor/harbor.service b/installer/build/scripts/harbor/harbor.service new file mode 100644 index 0000000000..6fecfb2ccf --- /dev/null +++ b/installer/build/scripts/harbor/harbor.service @@ -0,0 +1,22 @@ +[Unit] +Description=Harbor Container Registry +Documentation=http://github.com/vmware/harbor +After=vic-appliance.target psc-ready.target admiral.service +Requires=vic-appliance.target psc-ready.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=15 +TimeoutSec=infinity +ExecStartPre=/etc/vmware/wait_for_file.sh /etc/vmware/psc/harbor/harbor_startup +ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml down -v +ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml rm -f +ExecStartPre=/usr/bin/bash /etc/vmware/harbor/configure_harbor.sh +ExecStartPre=/usr/bin/python /etc/vmware/harbor/prepare --conf /storage/data/harbor/harbor.cfg --with-notary --with-clair +ExecStart=/etc/vmware/harbor/start_harbor.sh +ExecStop=/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml down -v +ExecStopPost=/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml rm -f + +[Install] +WantedBy=vic-appliance.target \ No newline at end of file diff --git a/installer/build/scripts/harbor/upgrade_from_0.5.sh b/installer/build/scripts/harbor/upgrade_from_0.5.sh index 68a46a361a..66fb161835 100755 --- a/installer/build/scripts/harbor/upgrade_from_0.5.sh +++ b/installer/build/scripts/harbor/upgrade_from_0.5.sh @@ -130,7 +130,6 @@ fi echo "Starting migration" echo "[=] shutting down harbor" -systemctl stop harbor_startup.service systemctl stop harbor.service echo "[=] copying data" diff --git a/installer/build/scripts/filesystem_provisioning.sh b/installer/build/scripts/provisioners/filesystem_provisioning.sh similarity index 100% rename from installer/build/scripts/filesystem_provisioning.sh rename to installer/build/scripts/provisioners/filesystem_provisioning.sh diff --git a/installer/build/scripts/package_provisioning.sh b/installer/build/scripts/provisioners/package_provisioning.sh similarity index 100% rename from installer/build/scripts/package_provisioning.sh rename to installer/build/scripts/provisioners/package_provisioning.sh diff --git a/installer/build/scripts/provision_admiral.sh b/installer/build/scripts/provisioners/provision_admiral.sh similarity index 100% rename from installer/build/scripts/provision_admiral.sh rename to installer/build/scripts/provisioners/provision_admiral.sh diff --git a/installer/build/scripts/provision_fileserver.sh b/installer/build/scripts/provisioners/provision_fileserver.sh similarity index 100% rename from installer/build/scripts/provision_fileserver.sh rename to installer/build/scripts/provisioners/provision_fileserver.sh diff --git a/installer/build/scripts/provision_harbor.sh b/installer/build/scripts/provisioners/provision_harbor.sh similarity index 100% rename from installer/build/scripts/provision_harbor.sh rename to installer/build/scripts/provisioners/provision_harbor.sh diff --git a/installer/build/scripts/system_settings.sh b/installer/build/scripts/provisioners/system_settings.sh similarity index 88% rename from installer/build/scripts/system_settings.sh rename to installer/build/scripts/provisioners/system_settings.sh index d8f4164816..4cc8e81a71 100644 --- a/installer/build/scripts/system_settings.sh +++ b/installer/build/scripts/provisioners/system_settings.sh @@ -16,21 +16,23 @@ set -euf -o pipefail # Enable systemd services systemctl enable toolbox.service -systemctl enable docker.service -systemctl enable vic-mounts.target repartition.service resizefs.service +systemctl enable vic-mounts.target repartition.service resizefs.service +systemctl enable vic-appliance.target vic-appliance-load-docker-images.service systemctl enable sshd_permitrootlogin.service -systemctl enable vic-appliance-load-docker-images.service -systemctl enable vic-appliance-docker-images-loaded.path -systemctl enable vic-appliance.target -systemctl enable vic-appliance-ready.target systemctl enable vic-appliance-environment.service systemctl enable getty@tty2.service systemctl enable ovf-network.service ova-firewall.service -systemctl enable harbor_startup.path admiral_startup.path get_token.timer -systemctl enable fileserver_startup.service fileserver.service +# Enable systemd component services +systemctl enable get_token.timer psc-ready.target +systemctl enable admiral.service +systemctl enable harbor.service +systemctl enable fileserver.service systemctl enable vic_machine_server.service +# Set our vic target as the default boot target +systemctl set-default vic-appliance.target + # Clean up temporary directories rm -rf /tmp/* /var/tmp/* tdnf clean all diff --git a/installer/build/scripts/systemd/admiral/admiral.service b/installer/build/scripts/systemd/admiral/admiral.service deleted file mode 100644 index c31c601e27..0000000000 --- a/installer/build/scripts/systemd/admiral/admiral.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Admiral is a highly scalable and very lightweight Container Management platform for deploying and managing container based applications. -Documentation=https://github.com/vmware/admiral -After=vic-appliance-ready.target get_token.service -Requires=vic-appliance-ready.target - -[Service] -Type=simple -Restart=on-failure -RestartSec=5 -ExecStart=/etc/vmware/admiral/start_admiral.sh -ExecStop=/usr/bin/docker stop vic-admiral -ExecStopPost=/usr/bin/docker rm vic-admiral - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/admiral/admiral_default_users.service b/installer/build/scripts/systemd/admiral/admiral_default_users.service deleted file mode 100644 index 0f4bcf93fa..0000000000 --- a/installer/build/scripts/systemd/admiral/admiral_default_users.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Admiral Default Users -Documentation=http://github.com/vmware/admiral -After=vic-appliance-ready.target admiral.service get_token.service -Requires=vic-appliance-ready.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/bash /etc/vmware/admiral/add_default_users.sh - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/admiral/admiral_startup.path b/installer/build/scripts/systemd/admiral/admiral_startup.path deleted file mode 100644 index d09054a8fc..0000000000 --- a/installer/build/scripts/systemd/admiral/admiral_startup.path +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Admiral PSC token dependency -Documentation=https://github.com/vmware/vic-product/installer - -[Path] -PathExists=/etc/vmware/psc/admiral/psc-config.properties - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/admiral/admiral_startup.service b/installer/build/scripts/systemd/admiral/admiral_startup.service deleted file mode 100644 index 8228bdf37d..0000000000 --- a/installer/build/scripts/systemd/admiral/admiral_startup.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Admiral Startup Configuration -Documentation=http://github.com/vmware/admiral -After=vic-appliance-ready.target admiral_startup.path -Requires=vic-appliance-ready.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/bash /etc/vmware/admiral/configure_admiral.sh -ExecStartPost=/usr/bin/systemctl start admiral.service -ExecStartPost=/usr/bin/systemctl start get_token.service -ExecStartPost=/usr/bin/systemctl start admiral_default_users.service - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/appliance/vic-appliance-docker-images-loaded.path b/installer/build/scripts/systemd/appliance/vic-appliance-docker-images-loaded.path deleted file mode 100644 index 803d75c51b..0000000000 --- a/installer/build/scripts/systemd/appliance/vic-appliance-docker-images-loaded.path +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Docker images loaded -Documentation=https://github.com/vmware/vic-product/installer - -[Path] -PathExists=/etc/vmware/firstboot -Unit=vic-appliance.target - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/docker.service b/installer/build/scripts/systemd/docker.service deleted file mode 100644 index d29b1541ba..0000000000 --- a/installer/build/scripts/systemd/docker.service +++ /dev/null @@ -1,33 +0,0 @@ -[Unit] -Description=Docker Application Container Engine -Documentation=https://docs.docker.com -After=network-online.target -Wants=network-online.target - -[Service] -Type=notify -# the default is not to use systemd for cgroups because the delegate issues still -# exists and systemd currently does not support the cgroup feature set required -# for containers run by docker -ExecStart=/usr/bin/dockerd --storage-driver=overlay2 -ExecReload=/bin/kill -s HUP $MAINPID -# Having non-zero Limit*s causes performance problems due to accounting overhead -# in the kernel. We recommend using cgroups to do container-local accounting. -LimitNOFILE=1048576 -LimitNPROC=1048576 -LimitCORE=infinity -# Uncomment TasksMax if your systemd version supports it. -# Only systemd 226 and above support this version. -#TasksMax=infinity -TimeoutStartSec=0 -# set delegate yes so that systemd does not reset the cgroups of docker containers -Delegate=yes -# kill only the docker process, not all processes in the cgroup -KillMode=process -# restart the docker process if it exits prematurely -Restart=on-failure -StartLimitBurst=3 -StartLimitInterval=60s - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/fileserver/fileserver_startup.service b/installer/build/scripts/systemd/fileserver/fileserver_startup.service deleted file mode 100644 index 91f6ed9611..0000000000 --- a/installer/build/scripts/systemd/fileserver/fileserver_startup.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=VIC Unified Installer Web Server Startup Configuration -Documentation=https://github.com/vmware/vic -After=vic-appliance-ready.target -Before=fileserver.service -Requires=vic-appliance-ready.target - -[Service] -Type=oneshot -ExecStart=/usr/bin/bash /etc/vmware/fileserver/configure_fileserver.sh - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/harbor/harbor.service b/installer/build/scripts/systemd/harbor/harbor.service deleted file mode 100644 index 3dd7ef0cb3..0000000000 --- a/installer/build/scripts/systemd/harbor/harbor.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Harbor Container Registry -Documentation=http://github.com/vmware/harbor -After=vic-appliance-ready.target admiral.service -Requires=vic-appliance-ready.target - -[Service] -Type=simple -Restart=on-failure -RestartSec=5 -ExecStart=/etc/vmware/harbor/start_harbor.sh -ExecStop=/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml down -v -ExecStopPost=/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml rm -f - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/harbor/harbor_startup.path b/installer/build/scripts/systemd/harbor/harbor_startup.path deleted file mode 100644 index f67b6332ff..0000000000 --- a/installer/build/scripts/systemd/harbor/harbor_startup.path +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Harbor PSC token dependency -Documentation=https://github.com/vmware/vic-product/installer - -[Path] -PathExists=/etc/vmware/psc/harbor/harbor_startup - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/harbor/harbor_startup.service b/installer/build/scripts/systemd/harbor/harbor_startup.service deleted file mode 100644 index 87307e7c10..0000000000 --- a/installer/build/scripts/systemd/harbor/harbor_startup.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Harbor Startup Configuration -Documentation=http://github.com/vmware/harbor -After=vic-appliance-ready.target harbor_startup.path get_token.service -Requires=vic-appliance-ready.target - -[Service] -Type=oneshot -ExecStartPre=/usr/bin/bash /etc/vmware/harbor/configure_harbor.sh -ExecStart=/usr/bin/python /etc/vmware/harbor/prepare --conf /storage/data/harbor/harbor.cfg --with-notary --with-clair -ExecStartPost=/bin/systemctl start harbor.service - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/mounts/vic-mounts.target b/installer/build/scripts/systemd/mounts/vic-mounts.target deleted file mode 100644 index e88ad5d0dd..0000000000 --- a/installer/build/scripts/systemd/mounts/vic-mounts.target +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Disk mounts required by VIC(Integrated containers engine on vSphere) -Documentation=https://github.com/vmware/vic/blob/master/doc/bundle/OVA-spec.md -Requires=storage-data.mount storage-db.mount storage-log.mount -After=storage-data.mount storage-db.mount storage-log.mount - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/systemd/vic-appliance.target b/installer/build/scripts/systemd/vic-appliance.target deleted file mode 100644 index cf82506ee5..0000000000 --- a/installer/build/scripts/systemd/vic-appliance.target +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=System customization for VIC Appliance -Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md -Requires=vic-mounts.target vic-appliance-docker-images-loaded.path -After=vic-mounts.target vic-appliance-docker-images-loaded.path - -[Install] -WantedBy=multi-user.target diff --git a/installer/build/scripts/upgrade/upgrade-admiral.sh b/installer/build/scripts/upgrade/upgrade-admiral.sh index 1fbcf41ed1..79f4fff0ab 100644 --- a/installer/build/scripts/upgrade/upgrade-admiral.sh +++ b/installer/build/scripts/upgrade/upgrade-admiral.sh @@ -47,7 +47,7 @@ function upgradeAdmiral { fi echo "Starting Admiral upgrade" | tee /dev/fd/3 - systemctl start admiral_startup.service + systemctl start admiral.service echo "Updating Admiral configuration" | tee /dev/fd/3 curl \ -s --insecure \ diff --git a/installer/build/scripts/upgrade/upgrade-harbor.sh b/installer/build/scripts/upgrade/upgrade-harbor.sh index ce2b370cce..9dfb4dd3bc 100644 --- a/installer/build/scripts/upgrade/upgrade-harbor.sh +++ b/installer/build/scripts/upgrade/upgrade-harbor.sh @@ -234,12 +234,11 @@ function upgradeHarbor { fi # Start Admiral for data migration - systemctl start admiral_startup.service + systemctl start admiral.service echo "Starting Harbor upgrade" | tee /dev/fd/3 echo "[=] Shutting down Harbor" | tee /dev/fd/3 - systemctl stop harbor_startup.service systemctl stop harbor.service echo "[=] Migrating Harbor data" | tee /dev/fd/3 @@ -258,5 +257,5 @@ function upgradeHarbor { fi echo "Starting Harbor" | tee /dev/fd/3 - systemctl start harbor_startup.service + systemctl start harbor.service } diff --git a/installer/build/scripts/upgrade/upgrade.sh b/installer/build/scripts/upgrade/upgrade.sh index 8a5286a9a8..f34a066540 100755 --- a/installer/build/scripts/upgrade/upgrade.sh +++ b/installer/build/scripts/upgrade/upgrade.sh @@ -78,19 +78,19 @@ function setDataVersion { # Prevent Admiral and Harbor from starting from path units function disableServicesStart { echo "Disabling and stopping Admiral and Harbor path startup" | tee /dev/fd/3 - systemctl stop admiral_startup.path - systemctl stop harbor_startup.path - systemctl disable admiral_startup.path - systemctl disable harbor_startup.path + systemctl stop admiral.service admiral-psc-token-ready.path + systemctl stop harbor.servce harbor-psc-token-ready.path + systemctl disable admiral.servce admiral-psc-token-ready.path + systemctl disable harbor.servce harbor-psc-token-ready.path } # Enable Admiral and Harbor starting from path units function enableServicesStart { echo "Enabling and starting Admiral and Harbor path startup" | tee /dev/fd/3 - systemctl enable admiral_startup.path - systemctl enable harbor_startup.path - systemctl start admiral_startup.path - systemctl start harbor_startup.path + systemctl enable admiral.servce admiral-psc-token-ready.path + systemctl enable harbor.servce harbor-psc-token-ready.path + systemctl start admiral.servce admiral-psc-token-ready.path + systemctl start harbor.servce harbor-psc-token-ready.path } # Check for presence of Admiral's PSC config file. If the file exists, the old diff --git a/installer/build/scripts/systemd/vic_machine_server/configure_vic_machine_server.sh b/installer/build/scripts/vic_machine_server/configure_vic_machine_server.sh similarity index 100% rename from installer/build/scripts/systemd/vic_machine_server/configure_vic_machine_server.sh rename to installer/build/scripts/vic_machine_server/configure_vic_machine_server.sh diff --git a/installer/build/scripts/systemd/vic_machine_server/vic-machine-server-logrotate b/installer/build/scripts/vic_machine_server/vic-machine-server-logrotate similarity index 100% rename from installer/build/scripts/systemd/vic_machine_server/vic-machine-server-logrotate rename to installer/build/scripts/vic_machine_server/vic-machine-server-logrotate diff --git a/installer/build/scripts/systemd/vic_machine_server/vic_machine_server.service b/installer/build/scripts/vic_machine_server/vic_machine_server.service similarity index 85% rename from installer/build/scripts/systemd/vic_machine_server/vic_machine_server.service rename to installer/build/scripts/vic_machine_server/vic_machine_server.service index 00b6192e07..a2c53e1592 100644 --- a/installer/build/scripts/systemd/vic_machine_server/vic_machine_server.service +++ b/installer/build/scripts/vic_machine_server/vic_machine_server.service @@ -1,13 +1,13 @@ [Unit] Description=VIC Machine API Documentation=https://github.com/vmware/vic -After=vic-appliance-ready.target -Requires=vic-appliance-ready.target +After=vic-appliance.target +Requires=vic-appliance.target [Service] Type=simple Restart=on-failure -RestartSec=5 +RestartSec=15 EnvironmentFile=/etc/vmware/environment ExecStartPre=-/usr/bin/docker kill vic-machine-server ExecStartPre=-/usr/bin/docker rm -f vic-machine-server @@ -16,4 +16,4 @@ ExecStart=/usr/bin/docker run --rm --user 10000:10000 --name vic-machine-server ExecStop=/usr/bin/docker stop vic-machine-server [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target \ No newline at end of file From 6e6996cc8bfe9665b7a62dcdf4c52bfca617ae00 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Mon, 18 Dec 2017 12:18:11 -0600 Subject: [PATCH 02/18] Split appliance target into appliance-ready and psc-ready targets --- installer/build/ova-manifest.json | 30 +++++++++++++++---- .../scripts/admiral/configure_admiral.sh | 4 +-- .../appliance/mounts/vic-mounts.target | 2 +- .../appliance/network/ovf-network.service | 2 +- .../scripts/appliance/psc/get_token.path | 9 ++++++ .../psc/vic-appliance-wait-psc-config.service | 2 +- .../vic-appliance-environment.service | 4 +-- .../appliance/vic-appliance-ready.target | 16 ++++++++++ .../scripts/appliance/vic-appliance.target | 13 ++------ .../build/scripts/appliance/wait_for_file.sh | 2 +- .../scripts/fileserver/fileserver.service | 4 +-- .../build/scripts/harbor/configure_harbor.sh | 5 ++-- installer/build/scripts/harbor/harbor.service | 4 +-- .../scripts/provisioners/system_settings.sh | 4 +-- .../vic_machine_server.service | 4 +-- 15 files changed, 72 insertions(+), 33 deletions(-) create mode 100644 installer/build/scripts/appliance/psc/get_token.path create mode 100644 installer/build/scripts/appliance/vic-appliance-ready.target diff --git a/installer/build/ova-manifest.json b/installer/build/ova-manifest.json index 00074a3a5c..afe3a9b5f2 100644 --- a/installer/build/ova-manifest.json +++ b/installer/build/ova-manifest.json @@ -89,8 +89,8 @@ }, { "type": "file", - "source": "scripts/appliance/network/ovf-network.service", - "destination": "/usr/lib/systemd/system/ovf-network.service" + "source": "scripts/appliance/vic-appliance-ready.target", + "destination": "/usr/lib/systemd/system/vic-appliance-ready.target" }, { "type": "file", @@ -126,6 +126,11 @@ "type": "file", "source": "scripts/appliance/toolbox.service", "destination": "/usr/lib/systemd/system/toolbox.service" + }, + { + "type": "file", + "source": "scripts/appliance/network/ovf-network.service", + "destination": "/usr/lib/systemd/system/ovf-network.service" }, { "type": "file", @@ -250,6 +255,21 @@ "source": "scripts/appliance/psc/get_token.timer", "destination": "/usr/lib/systemd/system/get_token.timer" }, + { + "type": "file", + "source": "scripts/appliance/psc/get_token.path", + "destination": "/usr/lib/systemd/system/get_token.path" + }, + { + "type": "file", + "source": "scripts/appliance/psc/psc-ready.target", + "destination": "/usr/lib/systemd/system/psc-ready.target" + }, + { + "type": "file", + "source": "scripts/appliance/psc/vic-appliance-wait-psc-config.service", + "destination": "/usr/lib/systemd/system/vic-appliance-wait-psc-config.service" + }, { "type": "shell", "script": "scripts/provisioners/provision_fileserver.sh" @@ -280,7 +300,7 @@ "destination": "/opt/vmware/fileserver/files/open_source_license.txt" }, { - "type": "scripts/provisioners", - "script": "scripts/system_settings.sh" + "type": "shell", + "script": "scripts/provisioners/system_settings.sh" } -] +] \ No newline at end of file diff --git a/installer/build/scripts/admiral/configure_admiral.sh b/installer/build/scripts/admiral/configure_admiral.sh index 076d467da2..865851b9b1 100755 --- a/installer/build/scripts/admiral/configure_admiral.sh +++ b/installer/build/scripts/admiral/configure_admiral.sh @@ -219,6 +219,6 @@ chown -R 10000:10000 $data_dir chown -R 10000:10000 $log_dir # Start on startup -echo "Enable admiral startup." -systemctl enable admiral_startup.service +echo "Enable admiral." +systemctl enable admiral.service echo "Services enabled. exiting..." diff --git a/installer/build/scripts/appliance/mounts/vic-mounts.target b/installer/build/scripts/appliance/mounts/vic-mounts.target index e1ee95643b..fdfc4e46ca 100644 --- a/installer/build/scripts/appliance/mounts/vic-mounts.target +++ b/installer/build/scripts/appliance/mounts/vic-mounts.target @@ -5,4 +5,4 @@ Requires=storage-data.mount storage-db.mount storage-log.mount repartition.servi After=storage-data.mount storage-db.mount storage-log.mount repartition.service resizefs.service [Install] -WantedBy=vic-appliance.target local-fs.target +WantedBy=vic-appliance-ready.target local-fs.target diff --git a/installer/build/scripts/appliance/network/ovf-network.service b/installer/build/scripts/appliance/network/ovf-network.service index f0add0b115..5c21296502 100644 --- a/installer/build/scripts/appliance/network/ovf-network.service +++ b/installer/build/scripts/appliance/network/ovf-network.service @@ -8,4 +8,4 @@ Type=oneshot ExecStart=/etc/vmware/network-config.sh [Install] -WantedBy=vic-appliance.target +WantedBy=vic-appliance-ready.target diff --git a/installer/build/scripts/appliance/psc/get_token.path b/installer/build/scripts/appliance/psc/get_token.path new file mode 100644 index 0000000000..d10b15f91e --- /dev/null +++ b/installer/build/scripts/appliance/psc/get_token.path @@ -0,0 +1,9 @@ +[Unit] +Description=Reload PSC configuration. +Documentation=http://github.com/vmware/vic-product/installer + +[Path] +PathModified=/etc/vmware/psc/admiral/psc-config.properties + +[Install] +WantedBy=paths.target \ No newline at end of file diff --git a/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service b/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service index fa147eeefe..f5c72af59d 100644 --- a/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service +++ b/installer/build/scripts/appliance/psc/vic-appliance-wait-psc-config.service @@ -1,10 +1,10 @@ [Unit] Description=Wait for PSC token to be present. Documentation=https://github.com/vmware/vic-product +Before=get_token.service [Service] Type=oneshot -TimeoutSec=infinity RemainAfterExit=true ExecStart=/etc/vmware/wait_for_file.sh /etc/vmware/psc/admiral/psc-config.properties diff --git a/installer/build/scripts/appliance/vic-appliance-environment.service b/installer/build/scripts/appliance/vic-appliance-environment.service index 593a68afb0..48cbd52e83 100644 --- a/installer/build/scripts/appliance/vic-appliance-environment.service +++ b/installer/build/scripts/appliance/vic-appliance-environment.service @@ -3,10 +3,10 @@ Description=VIC Appliance Environment Documentation=https://github.com/vmware/vic-product [Service] -Type=simple +Type=oneshot Restart=on-failure RestartSec=5 ExecStart=/etc/vmware/vic-appliance-environment.sh [Install] -WantedBy=vic-appliance.target +WantedBy=vic-appliance-ready.target diff --git a/installer/build/scripts/appliance/vic-appliance-ready.target b/installer/build/scripts/appliance/vic-appliance-ready.target new file mode 100644 index 0000000000..f4c94d9cf2 --- /dev/null +++ b/installer/build/scripts/appliance/vic-appliance-ready.target @@ -0,0 +1,16 @@ +[Unit] +Description=Target notifying dependent units that basic services are available. +Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md + + +Requires=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service +After=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service + +Requires=network-online.target systemd-resolved.service systemd-timesyncd.service +After=network-online.target systemd-resolved.service systemd-timesyncd.service + +Requires=ovf-network.service ova-firewall.service +After=ovf-network.service ova-firewall.service + +[Install] +WantedBy=vic-appliance.target \ No newline at end of file diff --git a/installer/build/scripts/appliance/vic-appliance.target b/installer/build/scripts/appliance/vic-appliance.target index 22fb24d0e4..2c5b35ca09 100644 --- a/installer/build/scripts/appliance/vic-appliance.target +++ b/installer/build/scripts/appliance/vic-appliance.target @@ -2,14 +2,7 @@ Description=System customization for VIC Appliance Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md -Requires=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service -After=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service +Requires=multi-user.target +After=multi-user.target -Requires=network-online.target systemd-resolved.service systemd-timesyncd.service -After=network-online.target systemd-resolved.service systemd-timesyncd.service - -Requires=ovf-network.service ova-firewall.service -After=ovf-network.service ova-firewall.service - -[Install] -Wants=multi-user.target +AllowIsolate=yes \ No newline at end of file diff --git a/installer/build/scripts/appliance/wait_for_file.sh b/installer/build/scripts/appliance/wait_for_file.sh index 52b16bdff7..8cdf973adb 100755 --- a/installer/build/scripts/appliance/wait_for_file.sh +++ b/installer/build/scripts/appliance/wait_for_file.sh @@ -3,7 +3,7 @@ # Use with a systemd serviceType=oneshot RemainAfterExit=yes file=$1 -intervalInSeconds=60 # 1 minute +intervalInSeconds=30 # 1 minute while [[ ! -e $file ]]; do echo "File $file does not yet exist. sleeping $intervalInSeconds seconds..." sleep $intervalInSeconds diff --git a/installer/build/scripts/fileserver/fileserver.service b/installer/build/scripts/fileserver/fileserver.service index 03da1fb926..32c2faef6f 100644 --- a/installer/build/scripts/fileserver/fileserver.service +++ b/installer/build/scripts/fileserver/fileserver.service @@ -1,8 +1,8 @@ [Unit] Description=VIC Unified Installer Web Server Documentation=https://github.com/vmware/vic -After=vic-appliance.target -Requires=vic-appliance.target +After=vic-appliance-ready.target +Requires=vic-appliance-ready.target [Service] Type=simple diff --git a/installer/build/scripts/harbor/configure_harbor.sh b/installer/build/scripts/harbor/configure_harbor.sh index a3d84e30ce..e677281538 100755 --- a/installer/build/scripts/harbor/configure_harbor.sh +++ b/installer/build/scripts/harbor/configure_harbor.sh @@ -154,8 +154,9 @@ iptables -w -A INPUT -j ACCEPT -p tcp --dport "${REGISTRY_PORT}" iptables -w -A INPUT -j ACCEPT -p tcp --dport "${NOTARY_PORT}" # Start on startup -echo "Enable harbor startup" -systemctl enable harbor_startup.service +echo "Enable harbor." +systemctl enable harbor.service +echo "Services enabled. exiting..." # cleanup common/config directory in preparation for running the harbor "prepare" script rm -rf /etc/vmware/harbor/common/config diff --git a/installer/build/scripts/harbor/harbor.service b/installer/build/scripts/harbor/harbor.service index 6fecfb2ccf..da71a105b3 100644 --- a/installer/build/scripts/harbor/harbor.service +++ b/installer/build/scripts/harbor/harbor.service @@ -1,8 +1,8 @@ [Unit] Description=Harbor Container Registry Documentation=http://github.com/vmware/harbor -After=vic-appliance.target psc-ready.target admiral.service -Requires=vic-appliance.target psc-ready.target +After=vic-appliance-ready.target psc-ready.target admiral.service +Requires=vic-appliance-ready.target psc-ready.target [Service] Type=simple diff --git a/installer/build/scripts/provisioners/system_settings.sh b/installer/build/scripts/provisioners/system_settings.sh index 4cc8e81a71..a88586af19 100644 --- a/installer/build/scripts/provisioners/system_settings.sh +++ b/installer/build/scripts/provisioners/system_settings.sh @@ -17,14 +17,14 @@ set -euf -o pipefail # Enable systemd services systemctl enable toolbox.service systemctl enable vic-mounts.target repartition.service resizefs.service -systemctl enable vic-appliance.target vic-appliance-load-docker-images.service +systemctl enable vic-appliance-ready.target vic-appliance-load-docker-images.service systemctl enable sshd_permitrootlogin.service systemctl enable vic-appliance-environment.service systemctl enable getty@tty2.service systemctl enable ovf-network.service ova-firewall.service # Enable systemd component services -systemctl enable get_token.timer psc-ready.target +systemctl enable get_token.timer get_token.path psc-ready.target systemctl enable admiral.service systemctl enable harbor.service systemctl enable fileserver.service diff --git a/installer/build/scripts/vic_machine_server/vic_machine_server.service b/installer/build/scripts/vic_machine_server/vic_machine_server.service index a2c53e1592..2671337eac 100644 --- a/installer/build/scripts/vic_machine_server/vic_machine_server.service +++ b/installer/build/scripts/vic_machine_server/vic_machine_server.service @@ -1,8 +1,8 @@ [Unit] Description=VIC Machine API Documentation=https://github.com/vmware/vic -After=vic-appliance.target -Requires=vic-appliance.target +After=vic-appliance-ready.target +Requires=vic-appliance-ready.target [Service] Type=simple From 3d51f28f46e7a9e09ff35cd9efc0ee13be6b7329 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Mon, 18 Dec 2017 12:37:27 -0600 Subject: [PATCH 03/18] Fix vic environment service Minor unit name fixes Revert bad changes to component services --- installer/DESIGN.md | 7 +++++-- installer/build/scripts/admiral/admiral.service | 5 ++--- .../build/scripts/admiral/configure_admiral.sh | 5 +---- .../scripts/appliance/mounts/storage-data.mount | 2 +- .../build/scripts/appliance/psc/get_token.sh | 6 ++---- .../appliance/vic-appliance-environment.service | 2 -- .../scripts/appliance/vic-appliance-ready.target | 1 - .../build/scripts/harbor/configure_harbor.sh | 7 ++----- installer/build/scripts/harbor/harbor.service | 1 - installer/build/scripts/upgrade/upgrade.sh | 16 ++++++++-------- 10 files changed, 21 insertions(+), 31 deletions(-) diff --git a/installer/DESIGN.md b/installer/DESIGN.md index dd775b74b3..124d33cda1 100644 --- a/installer/DESIGN.md +++ b/installer/DESIGN.md @@ -55,12 +55,15 @@ _TODO_ Add reference service to repo This allows the component to specify the startup and shutdown behavior through unit dependency directives such as `Wants`, `Requires`, `Before`, and `After`. -- A component unit file MUST have a `Requires=vic-appliance.service` and - `After=vic-appliance.service` statement +- A component unit file MUST have a `Requires=vic-appliance-ready.service` and + `After=vic-appliance-ready.service` statement This target ensures that the prerequisites for component services including disk, network, firewall, and Docker are ready before the component starts. +- A component unit file MUST have a `WantedBy=vic-appliance.target` statement in the `[Install]` + section of a unit file. + ### Requirements - A normally functioning component SHOULD NOT contain error messages in its logs or in the system diff --git a/installer/build/scripts/admiral/admiral.service b/installer/build/scripts/admiral/admiral.service index 8063806a83..d36c68b550 100644 --- a/installer/build/scripts/admiral/admiral.service +++ b/installer/build/scripts/admiral/admiral.service @@ -8,9 +8,8 @@ Requires=vic-appliance-ready.target psc-ready.target Type=simple Restart=on-failure RestartSec=15 -TimeoutSec=infinity -ExecStartPre=-/usr/bin/docker stop vic-admiral &> /dev/null -ExecStartPre=-/usr/bin/docker rm vic-admiral &> /dev/null +ExecStartPre=-/usr/bin/docker stop vic-admiral +ExecStartPre=-/usr/bin/docker rm vic-admiral ExecStartPre=/usr/bin/bash /etc/vmware/admiral/configure_admiral.sh ExecStart=/etc/vmware/admiral/start_admiral.sh ExecStartPost=/usr/bin/bash /etc/vmware/admiral/add_default_users.sh diff --git a/installer/build/scripts/admiral/configure_admiral.sh b/installer/build/scripts/admiral/configure_admiral.sh index 865851b9b1..5d45c6a6ab 100755 --- a/installer/build/scripts/admiral/configure_admiral.sh +++ b/installer/build/scripts/admiral/configure_admiral.sh @@ -218,7 +218,4 @@ echo "keystore.file=/configs/psc-config.keystore" >> $config_dir/psc-config.prop chown -R 10000:10000 $data_dir chown -R 10000:10000 $log_dir -# Start on startup -echo "Enable admiral." -systemctl enable admiral.service -echo "Services enabled. exiting..." +echo "Configuration finished. exiting..." \ No newline at end of file diff --git a/installer/build/scripts/appliance/mounts/storage-data.mount b/installer/build/scripts/appliance/mounts/storage-data.mount index 93f3a7ad39..6b9a4045d0 100644 --- a/installer/build/scripts/appliance/mounts/storage-data.mount +++ b/installer/build/scripts/appliance/mounts/storage-data.mount @@ -9,5 +9,5 @@ What=/dev/disk/by-path/pci-0000:03:00.0-scsi-0:0:1:0-part1 Where=/storage/data Type=ext4 -[Install] +[Install] RequiredBy=vic-mounts.target diff --git a/installer/build/scripts/appliance/psc/get_token.sh b/installer/build/scripts/appliance/psc/get_token.sh index ee409b9e35..6d05608f96 100755 --- a/installer/build/scripts/appliance/psc/get_token.sh +++ b/installer/build/scripts/appliance/psc/get_token.sh @@ -32,7 +32,5 @@ version=$(grep "version" /etc/vmware/psc/admiral/psc-config.properties | awk -F= # Copy harbor token to container mount path mkdir -p /storage/data/harbor/psc cp /etc/vmware/psc/harbor/tokens.properties /storage/data/harbor/psc/tokens.properties -# Create path for activating harbor.service to avoid its dependency on /storage/data -if [ ! -d /etc/vmware/psc/harbor/harbor_startup ]; then - mkdir -p /etc/vmware/psc/harbor/harbor_startup -fi +# Create path for activating harbor_startup.service to avoid its dependency on /storage/data +mkdir -p /etc/vmware/psc/harbor/harbor_startup \ No newline at end of file diff --git a/installer/build/scripts/appliance/vic-appliance-environment.service b/installer/build/scripts/appliance/vic-appliance-environment.service index 48cbd52e83..b9dda7921d 100644 --- a/installer/build/scripts/appliance/vic-appliance-environment.service +++ b/installer/build/scripts/appliance/vic-appliance-environment.service @@ -4,8 +4,6 @@ Documentation=https://github.com/vmware/vic-product [Service] Type=oneshot -Restart=on-failure -RestartSec=5 ExecStart=/etc/vmware/vic-appliance-environment.sh [Install] diff --git a/installer/build/scripts/appliance/vic-appliance-ready.target b/installer/build/scripts/appliance/vic-appliance-ready.target index f4c94d9cf2..c520b8f68b 100644 --- a/installer/build/scripts/appliance/vic-appliance-ready.target +++ b/installer/build/scripts/appliance/vic-appliance-ready.target @@ -2,7 +2,6 @@ Description=Target notifying dependent units that basic services are available. Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md - Requires=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service After=vic-mounts.target vic-appliance-environment.service vic-appliance-load-docker-images.service diff --git a/installer/build/scripts/harbor/configure_harbor.sh b/installer/build/scripts/harbor/configure_harbor.sh index e677281538..10a6204827 100755 --- a/installer/build/scripts/harbor/configure_harbor.sh +++ b/installer/build/scripts/harbor/configure_harbor.sh @@ -153,10 +153,7 @@ iptables -w -A INPUT -j ACCEPT -p tcp --dport "${REGISTRY_PORT}" # Open port for Notary iptables -w -A INPUT -j ACCEPT -p tcp --dport "${NOTARY_PORT}" -# Start on startup -echo "Enable harbor." -systemctl enable harbor.service -echo "Services enabled. exiting..." - # cleanup common/config directory in preparation for running the harbor "prepare" script rm -rf /etc/vmware/harbor/common/config + +echo "Configuration finished. exiting..." \ No newline at end of file diff --git a/installer/build/scripts/harbor/harbor.service b/installer/build/scripts/harbor/harbor.service index da71a105b3..578432fa00 100644 --- a/installer/build/scripts/harbor/harbor.service +++ b/installer/build/scripts/harbor/harbor.service @@ -8,7 +8,6 @@ Requires=vic-appliance-ready.target psc-ready.target Type=simple Restart=on-failure RestartSec=15 -TimeoutSec=infinity ExecStartPre=/etc/vmware/wait_for_file.sh /etc/vmware/psc/harbor/harbor_startup ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml down -v ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml rm -f diff --git a/installer/build/scripts/upgrade/upgrade.sh b/installer/build/scripts/upgrade/upgrade.sh index f34a066540..78d82287a8 100755 --- a/installer/build/scripts/upgrade/upgrade.sh +++ b/installer/build/scripts/upgrade/upgrade.sh @@ -78,19 +78,19 @@ function setDataVersion { # Prevent Admiral and Harbor from starting from path units function disableServicesStart { echo "Disabling and stopping Admiral and Harbor path startup" | tee /dev/fd/3 - systemctl stop admiral.service admiral-psc-token-ready.path - systemctl stop harbor.servce harbor-psc-token-ready.path - systemctl disable admiral.servce admiral-psc-token-ready.path - systemctl disable harbor.servce harbor-psc-token-ready.path + systemctl stop admiral.service + systemctl stop harbor.servce + systemctl disable admiral.servce + systemctl disable harbor.servce } # Enable Admiral and Harbor starting from path units function enableServicesStart { echo "Enabling and starting Admiral and Harbor path startup" | tee /dev/fd/3 - systemctl enable admiral.servce admiral-psc-token-ready.path - systemctl enable harbor.servce harbor-psc-token-ready.path - systemctl start admiral.servce admiral-psc-token-ready.path - systemctl start harbor.servce harbor-psc-token-ready.path + systemctl enable admiral.servce + systemctl enable harbor.servce + systemctl start admiral.servce + systemctl start harbor.servce } # Check for presence of Admiral's PSC config file. If the file exists, the old From e1ce3fcc199031c25c429a89db6c318bc9f0ce23 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Mon, 18 Dec 2017 13:54:04 -0600 Subject: [PATCH 04/18] Fix missing net-tools package --- installer/build/baseimage/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/build/baseimage/install.sh b/installer/build/baseimage/install.sh index 331c692778..c8fc0449c6 100755 --- a/installer/build/baseimage/install.sh +++ b/installer/build/baseimage/install.sh @@ -66,7 +66,8 @@ tdnf install -q --refresh -y \ iproute2 iptables iputils \ cdrkit xfsprogs sudo \ lvm2 parted gptfdisk \ - e2fsprogs docker logrotate &>/dev/null + e2fsprogs docker \ + net-tools logrotate &>/dev/null progress "installing package dependencies" tdnf install -q --refresh -y \ From ff1a5d0a282fd0c3cfe3ad32bfacdf356ac1940c Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Mon, 18 Dec 2017 14:33:10 -0600 Subject: [PATCH 05/18] Cherry pick fileserver changes from old branch Fix typo --- installer/build/scripts/appliance/psc/get_token.service | 2 +- installer/fileserver/tasks.go | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/installer/build/scripts/appliance/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service index 100141160a..dd1c6ba044 100644 --- a/installer/build/scripts/appliance/psc/get_token.service +++ b/installer/build/scripts/appliance/psc/get_token.service @@ -2,7 +2,7 @@ Description=PSC Get Token Documentation=http://github.com/vmware/vic-product/installer Requires=vic-appliance-wait-psc-config.service -After=vic-vic-appliance-wait-psc-config.service +After=vic-appliance-wait-psc-config.service [Service] Type=oneshot diff --git a/installer/fileserver/tasks.go b/installer/fileserver/tasks.go index 4c63de63ec..4c38d825f1 100644 --- a/installer/fileserver/tasks.go +++ b/installer/fileserver/tasks.go @@ -18,9 +18,7 @@ import ( "context" "fmt" "net" - "os" "os/exec" - "path/filepath" "strings" log "github.com/Sirupsen/logrus" @@ -89,11 +87,6 @@ func registerWithPSC(ctx context.Context) error { // Register all VIC components with PSC cmdName := "/usr/bin/java" for _, client := range []string{"harbor", "engine", "admiral"} { - pscConfFile := filepath.Join(pscConfDir, client, pscConfFileName) - if _, err := os.Stat(pscConfFile); err == nil { - log.Infof("Skipping registering %s with PSC since PSC config file is present", client) - continue - } cmdArgs := []string{ "-jar", From 76e26aff0909c460db120869c3d7d47a7858de7f Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 19 Dec 2017 11:37:48 -0600 Subject: [PATCH 06/18] Ensure network connectivity before get_token --- installer/build/scripts/appliance/psc/get_token.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/build/scripts/appliance/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service index dd1c6ba044..ee2ec3e9f5 100644 --- a/installer/build/scripts/appliance/psc/get_token.service +++ b/installer/build/scripts/appliance/psc/get_token.service @@ -1,8 +1,8 @@ [Unit] Description=PSC Get Token Documentation=http://github.com/vmware/vic-product/installer -Requires=vic-appliance-wait-psc-config.service -After=vic-appliance-wait-psc-config.service +Requires=network-online.target vic-appliance-wait-psc-config.service +After=network-online.target vic-appliance-wait-psc-config.service [Service] Type=oneshot From 2e95eef2b4506b6c819ddd3306e885016191a923 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 19 Dec 2017 14:10:46 -0600 Subject: [PATCH 07/18] Test changes to wait for systemd services Update test markdown Fix bad test variable name Fix broken keyword Add extra time for selenium tests Bump wait time some more Sleep before adding default users --- .../scripts/admiral/add_default_users.sh | 2 ++ tests/resources/OVA-Util.robot | 11 ++++++++++ tests/resources/Util.robot | 11 +++++++--- .../page-objects/Remove-Host-Modal-Util.robot | 2 +- .../Group1-OVA-Install/1-01-Install.md | 16 +++++---------- .../Group1-OVA-Install/1-01-Install.robot | 20 ------------------- 6 files changed, 27 insertions(+), 35 deletions(-) diff --git a/installer/build/scripts/admiral/add_default_users.sh b/installer/build/scripts/admiral/add_default_users.sh index 4072ab7eeb..b10d7d6994 100755 --- a/installer/build/scripts/admiral/add_default_users.sh +++ b/installer/build/scripts/admiral/add_default_users.sh @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. set -uf -o pipefail +sleep 30 # let admiral and harbor stabalize before trying to add users + # and groups to the default project # Populated by configure_admiral.sh ADMIRAL_EXPOSED_PORT="" diff --git a/tests/resources/OVA-Util.robot b/tests/resources/OVA-Util.robot index dbfab8bf72..27fbc76e2e 100644 --- a/tests/resources/OVA-Util.robot +++ b/tests/resources/OVA-Util.robot @@ -56,6 +56,17 @@ Install VIC Product OVA Log To Console ${out} Should Contain ${out} 200 + Log To Console ssh into appliance... + ${out}= Run sshpass -p ${OVA_PASSWORD_ROOT} ssh -o StrictHostKeyChecking\=no ${OVA_USERNAME_ROOT}@${ova-ip} + + Open Connection ${ova-ip} + Wait Until Keyword Succeeds 10x 5s Login ${OVA_USERNAME_ROOT} ${OVA_PASSWORD_ROOT} + + Wait Until Keyword Succeeds 10x 20s Check service running admiral + Wait Until Keyword Succeeds 10x 20s Check service running harbor + + Close connection + [Return] ${ova-ip} Install Common OVA If Not Already diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 9e419fe2f2..882a932f0e 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -91,8 +91,7 @@ Global Setup With Complete OVA Installation # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub - Set Global Variable ${EXPLICIT_WAIT} 30 - Set Global Variable ${EXTRA_EXPLICIT_WAIT} 50 + Set Global Variable ${EXPLICIT_WAIT} 120 Set Global Variable ${PRIMARY_PORT} 8282 Set Global Variable ${GS_PAGE_PORT} 9443 Set Global Variable ${HARBOR_PORT} 443 @@ -113,4 +112,10 @@ Run command and Return output ${rc} ${output}= Run And Return Rc And Output ${command} Log ${output} Should Be Equal As Integers ${rc} 0 - [Return] ${output} \ No newline at end of file + [Return] ${output} + +Check service running + [Arguments] ${service-name} + Log To Console Checking status of ${service-name}... + ${out}= Execute Command systemctl status ${service-name} + Should Contain ${out} Active: active (running) \ No newline at end of file diff --git a/tests/resources/page-objects/Remove-Host-Modal-Util.robot b/tests/resources/page-objects/Remove-Host-Modal-Util.robot index b3f75f45e4..3d589ef8d0 100644 --- a/tests/resources/page-objects/Remove-Host-Modal-Util.robot +++ b/tests/resources/page-objects/Remove-Host-Modal-Util.robot @@ -30,4 +30,4 @@ Verify Modal for Remove Container Host Click Remove On Remove Container Host Click Button ${rch-button-remove} - Wait Until Page Does Not Contain Element ${rch-button-remove} timeout=${EXTRA_EXPLICIT_WAIT} \ No newline at end of file + Wait Until Page Does Not Contain Element ${rch-button-remove} timeout=${EXPLICIT_WAIT} \ No newline at end of file diff --git a/tests/test-cases/Group1-OVA-Install/1-01-Install.md b/tests/test-cases/Group1-OVA-Install/1-01-Install.md index 15c3c8d459..ca2213e2e6 100644 --- a/tests/test-cases/Group1-OVA-Install/1-01-Install.md +++ b/tests/test-cases/Group1-OVA-Install/1-01-Install.md @@ -2,7 +2,7 @@ Test 1-01 - Install ======= # Purpose: -To verify OVA is installed successfully, all required services are running, able to download vic engine archive file. +To download vic engine archive file and verify the engine binary can create a vch. #References: @@ -12,19 +12,13 @@ This test requires that a: - Installed VIC appliance # Test Steps: -1. SSH into OVA as a root user -2. Check status of harbor -3. Check status of admiral -4. Check status of fileserver -5. Download VIC engine tar file from management portal UI -6. Extract VIC engine files and Install VCH -7. Run docker info command against the installed VCH +1. Download VIC engine tar file from fileserver +2. Extract VIC engine files and Install VCH +3. Run docker info command against the installed VCH # Expected Outcome: -* Register page should return 200 status -* Step 2 - 5 should result in success * VIC engine archive file should get downloaded and extracted -* Step 8 should pass and contain expected output +3 Step 8 should pass and contain expected output #Possible Problems: Harbor and other services may take up to 10 min to start up once OVA is installed. diff --git a/tests/test-cases/Group1-OVA-Install/1-01-Install.robot b/tests/test-cases/Group1-OVA-Install/1-01-Install.robot index 7f944e0321..9239026565 100644 --- a/tests/test-cases/Group1-OVA-Install/1-01-Install.robot +++ b/tests/test-cases/Group1-OVA-Install/1-01-Install.robot @@ -17,27 +17,7 @@ Documentation Test 1-01 - Install Test Resource ../../resources/Util.robot Test Timeout 50 minutes -*** Keywords *** -Check service running - [Arguments] ${service-name} - Log To Console Checking status of ${service-name}... - ${out}= Execute Command systemctl status ${service-name} - Should Contain ${out} Active: active (running) - *** Test Cases *** -Verify OVA services - Log To Console ssh into appliance... - ${out}= Run sshpass -p ${OVA_PASSWORD_ROOT} ssh -o StrictHostKeyChecking\=no ${OVA_USERNAME_ROOT}@%{OVA_IP} - - Open Connection %{OVA_IP} - Wait Until Keyword Succeeds 10x 5s Login ${OVA_USERNAME_ROOT} ${OVA_PASSWORD_ROOT} - - Wait Until Keyword Succeeds 10x 20s Check service running harbor - Wait Until Keyword Succeeds 10x 20s Check service running admiral - Wait Until Keyword Succeeds 10x 20s Check service running fileserver - - Close connection - Verify VIC engine download and create VCH Download VIC Engine %{OVA_IP} From 3778601aeb11e9677cdeb27b90304b2b7d01c481 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 20 Dec 2017 14:28:39 -0600 Subject: [PATCH 08/18] Bump timeout to 5 minutes --- tests/resources/Util.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 882a932f0e..b444c26f0c 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -91,7 +91,7 @@ Global Setup With Complete OVA Installation # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub - Set Global Variable ${EXPLICIT_WAIT} 120 + Set Global Variable ${EXPLICIT_WAIT} 300 Set Global Variable ${PRIMARY_PORT} 8282 Set Global Variable ${GS_PAGE_PORT} 9443 Set Global Variable ${HARBOR_PORT} 443 From c09fd2e2b3cee1d44da872b0f813364d011f18a2 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 20 Dec 2017 15:17:41 -0600 Subject: [PATCH 09/18] Restart admiral/harbor after psc changes Dont block on harbor/admiral restart Final fixes for startup units --- .../build/scripts/appliance/get_vic_appliance_logs.sh | 2 -- installer/build/scripts/appliance/psc/get_token.service | 1 + installer/build/scripts/appliance/psc/get_token.sh | 8 +------- installer/build/scripts/harbor/harbor.service | 1 - installer/build/scripts/upgrade/upgrade.sh | 4 ++-- tests/resources/Util.robot | 2 +- 6 files changed, 5 insertions(+), 13 deletions(-) diff --git a/installer/build/scripts/appliance/get_vic_appliance_logs.sh b/installer/build/scripts/appliance/get_vic_appliance_logs.sh index 6feef01dfc..be4618b5a0 100755 --- a/installer/build/scripts/appliance/get_vic_appliance_logs.sh +++ b/installer/build/scripts/appliance/get_vic_appliance_logs.sh @@ -137,9 +137,7 @@ function getDiagInfo { commandToFile "docker images" "docker_images" "appliance" # Services - commandToCompressed "journalctl -u admiral_startup --no-pager" "journal_admiral_startup" "admiral" commandToCompressed "journalctl -u admiral --no-pager" "journal_admiral" "admiral" - commandToCompressed "journalctl -u harbor_startup --no-pager" "journal_harbor_startup" "harbor" commandToCompressed "journalctl -u harbor --no-pager" "journal_harbor" "harbor" commandToCompressed "journalctl -u fileserver --no-pager" "journal_fileserver" "appliance" commandToCompressed "journalctl -u get_token --no-pager" "journal_get_token" "psc" diff --git a/installer/build/scripts/appliance/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service index ee2ec3e9f5..df4f52e658 100644 --- a/installer/build/scripts/appliance/psc/get_token.service +++ b/installer/build/scripts/appliance/psc/get_token.service @@ -7,6 +7,7 @@ After=network-online.target vic-appliance-wait-psc-config.service [Service] Type=oneshot ExecStart=/usr/bin/bash /etc/vmware/psc/get_token.sh +ExecStartPost=/usr/bin/systemctl --no-block restart admiral harbor [Install] WantedBy=psc-ready.target diff --git a/installer/build/scripts/appliance/psc/get_token.sh b/installer/build/scripts/appliance/psc/get_token.sh index 6d05608f96..a89d61dee7 100755 --- a/installer/build/scripts/appliance/psc/get_token.sh +++ b/installer/build/scripts/appliance/psc/get_token.sh @@ -27,10 +27,4 @@ version=$(grep "version" /etc/vmware/psc/admiral/psc-config.properties | awk -F= /usr/bin/java -jar /etc/vmware/admiral/admiral-auth-psc-1.2.0-SNAPSHOT-command.jar --command=get-token --version=$version --configFile=/etc/vmware/psc/admiral/psc-config.properties --tokenFile=/etc/vmware/psc/admiral/tokens.properties # Put the engine token in guestinfo -/etc/vmware/set_guestinfo.sh -f /etc/vmware/psc/engine/tokens.properties "engine.token" - -# Copy harbor token to container mount path -mkdir -p /storage/data/harbor/psc -cp /etc/vmware/psc/harbor/tokens.properties /storage/data/harbor/psc/tokens.properties -# Create path for activating harbor_startup.service to avoid its dependency on /storage/data -mkdir -p /etc/vmware/psc/harbor/harbor_startup \ No newline at end of file +/etc/vmware/set_guestinfo.sh -f /etc/vmware/psc/engine/tokens.properties "engine.token" \ No newline at end of file diff --git a/installer/build/scripts/harbor/harbor.service b/installer/build/scripts/harbor/harbor.service index 578432fa00..b017e65377 100644 --- a/installer/build/scripts/harbor/harbor.service +++ b/installer/build/scripts/harbor/harbor.service @@ -8,7 +8,6 @@ Requires=vic-appliance-ready.target psc-ready.target Type=simple Restart=on-failure RestartSec=15 -ExecStartPre=/etc/vmware/wait_for_file.sh /etc/vmware/psc/harbor/harbor_startup ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml down -v ExecStartPre=-/usr/local/bin/docker-compose -f /etc/vmware/harbor/docker-compose.yml -f /etc/vmware/harbor/docker-compose.notary.yml -f /etc/vmware/harbor/docker-compose.clair.yml rm -f ExecStartPre=/usr/bin/bash /etc/vmware/harbor/configure_harbor.sh diff --git a/installer/build/scripts/upgrade/upgrade.sh b/installer/build/scripts/upgrade/upgrade.sh index 78d82287a8..852d79f564 100755 --- a/installer/build/scripts/upgrade/upgrade.sh +++ b/installer/build/scripts/upgrade/upgrade.sh @@ -77,7 +77,7 @@ function setDataVersion { # Prevent Admiral and Harbor from starting from path units function disableServicesStart { - echo "Disabling and stopping Admiral and Harbor path startup" | tee /dev/fd/3 + echo "Disabling and stopping Admiral and Harbor" | tee /dev/fd/3 systemctl stop admiral.service systemctl stop harbor.servce systemctl disable admiral.servce @@ -86,7 +86,7 @@ function disableServicesStart { # Enable Admiral and Harbor starting from path units function enableServicesStart { - echo "Enabling and starting Admiral and Harbor path startup" | tee /dev/fd/3 + echo "Enabling and starting Admiral and Harbor" | tee /dev/fd/3 systemctl enable admiral.servce systemctl enable harbor.servce systemctl start admiral.servce diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index b444c26f0c..882a932f0e 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -91,7 +91,7 @@ Global Setup With Complete OVA Installation # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub - Set Global Variable ${EXPLICIT_WAIT} 300 + Set Global Variable ${EXPLICIT_WAIT} 120 Set Global Variable ${PRIMARY_PORT} 8282 Set Global Variable ${GS_PAGE_PORT} 9443 Set Global Variable ${HARBOR_PORT} 443 From 61db16f6f064bfa7cab7ef4d34c344e85700a71a Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 20 Dec 2017 17:40:58 -0600 Subject: [PATCH 10/18] Verify admiral is up before running selenium tests --- tests/resources/OVA-Util.robot | 1 + tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/resources/OVA-Util.robot b/tests/resources/OVA-Util.robot index 27fbc76e2e..65ce1d7529 100644 --- a/tests/resources/OVA-Util.robot +++ b/tests/resources/OVA-Util.robot @@ -62,6 +62,7 @@ Install VIC Product OVA Open Connection ${ova-ip} Wait Until Keyword Succeeds 10x 5s Login ${OVA_USERNAME_ROOT} ${OVA_PASSWORD_ROOT} + Wait Until Keyword Succeeds 10x 20s Check service running fileserver Wait Until Keyword Succeeds 10x 20s Check service running admiral Wait Until Keyword Succeeds 10x 20s Check service running harbor diff --git a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot index d5a92bdf5d..233b60a316 100644 --- a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot +++ b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot @@ -27,6 +27,15 @@ ${cp-card-status-stopped} STOPPED *** Keywords *** Setup Base State + Log To Console \nWaiting for Admiral to come up... + :FOR ${i} IN RANGE 10 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${ova-ip}:8282 + \ Exit For Loop If '302' in '''${out}''' + \ Sleep 20s + Log To Console ${rc} + Log To Console ${out} + Should Contain ${out} 302 + Open Firefox Browser Navigate To VIC UI Home Page Login On Single Sign-On Page From 5a4181d3213d30dc0a12e12876e017140ae36fce Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Mon, 8 Jan 2018 11:15:21 -0600 Subject: [PATCH 11/18] Intorduce psc reconfigure path --- installer/build/ova-manifest.json | 15 ++++++++++----- .../build/scripts/appliance/psc/get_token.service | 1 - .../{get_token.path => reconfigure_token.path} | 0 .../appliance/psc/reconfigure_token.service | 12 ++++++++++++ .../build/scripts/provisioners/system_settings.sh | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) rename installer/build/scripts/appliance/psc/{get_token.path => reconfigure_token.path} (100%) create mode 100644 installer/build/scripts/appliance/psc/reconfigure_token.service diff --git a/installer/build/ova-manifest.json b/installer/build/ova-manifest.json index afe3a9b5f2..884b413de9 100644 --- a/installer/build/ova-manifest.json +++ b/installer/build/ova-manifest.json @@ -255,11 +255,6 @@ "source": "scripts/appliance/psc/get_token.timer", "destination": "/usr/lib/systemd/system/get_token.timer" }, - { - "type": "file", - "source": "scripts/appliance/psc/get_token.path", - "destination": "/usr/lib/systemd/system/get_token.path" - }, { "type": "file", "source": "scripts/appliance/psc/psc-ready.target", @@ -270,6 +265,16 @@ "source": "scripts/appliance/psc/vic-appliance-wait-psc-config.service", "destination": "/usr/lib/systemd/system/vic-appliance-wait-psc-config.service" }, + { + "type": "file", + "source": "scripts/appliance/psc/reconfigure_token.path", + "destination": "/usr/lib/systemd/system/reconfigure_token.path" + }, + { + "type": "file", + "source": "scripts/appliance/psc/reconfigure_token.service", + "destination": "/usr/lib/systemd/system/reconfigure_token.service" + }, { "type": "shell", "script": "scripts/provisioners/provision_fileserver.sh" diff --git a/installer/build/scripts/appliance/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service index df4f52e658..ee2ec3e9f5 100644 --- a/installer/build/scripts/appliance/psc/get_token.service +++ b/installer/build/scripts/appliance/psc/get_token.service @@ -7,7 +7,6 @@ After=network-online.target vic-appliance-wait-psc-config.service [Service] Type=oneshot ExecStart=/usr/bin/bash /etc/vmware/psc/get_token.sh -ExecStartPost=/usr/bin/systemctl --no-block restart admiral harbor [Install] WantedBy=psc-ready.target diff --git a/installer/build/scripts/appliance/psc/get_token.path b/installer/build/scripts/appliance/psc/reconfigure_token.path similarity index 100% rename from installer/build/scripts/appliance/psc/get_token.path rename to installer/build/scripts/appliance/psc/reconfigure_token.path diff --git a/installer/build/scripts/appliance/psc/reconfigure_token.service b/installer/build/scripts/appliance/psc/reconfigure_token.service new file mode 100644 index 0000000000..2752c48d59 --- /dev/null +++ b/installer/build/scripts/appliance/psc/reconfigure_token.service @@ -0,0 +1,12 @@ +[Unit] +Description=PSC Get Token +Documentation=http://github.com/vmware/vic-product/installer +Requires=network-online.target vic-appliance-wait-psc-config.service +After=network-online.target vic-appliance-wait-psc-config.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl --no-block restart admiral harbor + +[Install] +WantedBy=psc-ready.target diff --git a/installer/build/scripts/provisioners/system_settings.sh b/installer/build/scripts/provisioners/system_settings.sh index a88586af19..7f8288042c 100644 --- a/installer/build/scripts/provisioners/system_settings.sh +++ b/installer/build/scripts/provisioners/system_settings.sh @@ -24,7 +24,7 @@ systemctl enable getty@tty2.service systemctl enable ovf-network.service ova-firewall.service # Enable systemd component services -systemctl enable get_token.timer get_token.path psc-ready.target +systemctl enable get_token.timer reconfigure_token.path psc-ready.target systemctl enable admiral.service systemctl enable harbor.service systemctl enable fileserver.service From a36be1ff27a3e822200c6c08089da66bd4f67dcb Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 9 Jan 2018 10:07:11 -0600 Subject: [PATCH 12/18] Add sso wait to harbor tests Decrease harbor and admiral test timeouts --- tests/resources/Util.robot | 2 +- tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot | 4 ++-- tests/test-cases/Group4-Harbor/4-01-Harbor.robot | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 882a932f0e..a46d73fc32 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -91,7 +91,7 @@ Global Setup With Complete OVA Installation # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub - Set Global Variable ${EXPLICIT_WAIT} 120 + Set Global Variable ${EXPLICIT_WAIT} 60 Set Global Variable ${PRIMARY_PORT} 8282 Set Global Variable ${GS_PAGE_PORT} 9443 Set Global Variable ${HARBOR_PORT} 443 diff --git a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot index 233b60a316..b86f068cc9 100644 --- a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot +++ b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot @@ -29,9 +29,9 @@ ${cp-card-status-stopped} STOPPED Setup Base State Log To Console \nWaiting for Admiral to come up... :FOR ${i} IN RANGE 10 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${ova-ip}:8282 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${BASE_URL}:8282 \ Exit For Loop If '302' in '''${out}''' - \ Sleep 20s + \ Sleep 10s Log To Console ${rc} Log To Console ${out} Should Contain ${out} 302 diff --git a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot index 978a1a05cf..f5989ea1be 100644 --- a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot +++ b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot @@ -27,6 +27,15 @@ ${card-status-stopped} STOPPED *** Keywords *** Setup Base State + Log To Console \nWaiting for Harbor to come up... + :FOR ${i} IN RANGE 10 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${BASE_URL}:8282 + \ Exit For Loop If '302' in '''${out}''' + \ Sleep 10s + Log To Console ${rc} + Log To Console ${out} + Should Contain ${out} 302 + Open Firefox Browser Navigate To VIC UI Home Page Login On Single Sign-On Page From 6787898a9f9495e97e00680aafd3003a641f86c1 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 9 Jan 2018 15:37:59 -0600 Subject: [PATCH 13/18] Use OVA_IP variable in tests instead of BASE-URL --- tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot | 4 ++-- tests/test-cases/Group4-Harbor/4-01-Harbor.robot | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot index b86f068cc9..df40cd8f9e 100644 --- a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot +++ b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot @@ -28,8 +28,8 @@ ${cp-card-status-stopped} STOPPED *** Keywords *** Setup Base State Log To Console \nWaiting for Admiral to come up... - :FOR ${i} IN RANGE 10 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${BASE_URL}:8282 + :FOR ${i} IN RANGE 6 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 \ Exit For Loop If '302' in '''${out}''' \ Sleep 10s Log To Console ${rc} diff --git a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot index f5989ea1be..c7efe60aa8 100644 --- a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot +++ b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot @@ -28,8 +28,8 @@ ${card-status-stopped} STOPPED *** Keywords *** Setup Base State Log To Console \nWaiting for Harbor to come up... - :FOR ${i} IN RANGE 10 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${BASE_URL}:8282 + :FOR ${i} IN RANGE 6 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 \ Exit For Loop If '302' in '''${out}''' \ Sleep 10s Log To Console ${rc} From 311413b39ea2ebc45ad170f06b20ff32087dc9ab Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 10 Jan 2018 14:04:54 -0600 Subject: [PATCH 14/18] Add pr comments for test updates --- installer/build/scripts/appliance/psc/get_token.sh | 6 +++++- tests/common-ova/OVA-Setup.robot | 5 ++--- tests/resources/OVA-Util.robot | 12 +++++++++++- tests/resources/Util.robot | 3 ++- .../page-objects/Remove-Host-Modal-Util.robot | 2 +- .../2-01-Getting-Started.robot | 2 -- .../test-cases/Group3-Admiral/3-01-Admiral-UI.robot | 9 --------- tests/test-cases/Group4-Harbor/4-01-Harbor.robot | 9 --------- 8 files changed, 21 insertions(+), 27 deletions(-) diff --git a/installer/build/scripts/appliance/psc/get_token.sh b/installer/build/scripts/appliance/psc/get_token.sh index a89d61dee7..d41217e036 100755 --- a/installer/build/scripts/appliance/psc/get_token.sh +++ b/installer/build/scripts/appliance/psc/get_token.sh @@ -27,4 +27,8 @@ version=$(grep "version" /etc/vmware/psc/admiral/psc-config.properties | awk -F= /usr/bin/java -jar /etc/vmware/admiral/admiral-auth-psc-1.2.0-SNAPSHOT-command.jar --command=get-token --version=$version --configFile=/etc/vmware/psc/admiral/psc-config.properties --tokenFile=/etc/vmware/psc/admiral/tokens.properties # Put the engine token in guestinfo -/etc/vmware/set_guestinfo.sh -f /etc/vmware/psc/engine/tokens.properties "engine.token" \ No newline at end of file +/etc/vmware/set_guestinfo.sh -f /etc/vmware/psc/engine/tokens.properties "engine.token" + +# Copy harbor token to container mount path +mkdir -p /storage/data/harbor/psc +cp /etc/vmware/psc/harbor/tokens.properties /storage/data/harbor/psc/tokens.properties \ No newline at end of file diff --git a/tests/common-ova/OVA-Setup.robot b/tests/common-ova/OVA-Setup.robot index 97f336636d..0378aecc9c 100644 --- a/tests/common-ova/OVA-Setup.robot +++ b/tests/common-ova/OVA-Setup.robot @@ -21,9 +21,8 @@ Suite Setup Global Environment Setup *** Variables *** ${default-ova-file-path} installer/bin/vic-*.ova -*** Keywords *** - *** Test Cases *** Install Common OVA - Install Common OVA If Not Already ${default-ova-file-path} \ No newline at end of file + Install Common OVA If Not Already ${default-ova-file-path} + Wait for SSO Redirect \ No newline at end of file diff --git a/tests/resources/OVA-Util.robot b/tests/resources/OVA-Util.robot index 65ce1d7529..9bd5d42a98 100644 --- a/tests/resources/OVA-Util.robot +++ b/tests/resources/OVA-Util.robot @@ -94,4 +94,14 @@ Cleanup VIC Product OVA Log To Console \nCleaning up VIC appliance... ${rc}= Wait Until Keyword Succeeds 10x 5s Run GOVC vm.destroy ${ova_target_vm_name} Run Keyword And Ignore Error Run GOVC datastore.rm /%{TEST_DATASTORE}/vm/${ova_target_vm_name} - Run Keyword if ${rc}==0 Log To Console \nVIC Product OVA deployment ${ova_target_vm_name} is cleaned up on test server %{TEST_URL} \ No newline at end of file + Run Keyword if ${rc}==0 Log To Console \nVIC Product OVA deployment ${ova_target_vm_name} is cleaned up on test server %{TEST_URL} + +Wait for SSO Redirect + Log To Console \nWaiting for SSO redirect to come up... + :FOR ${i} IN RANGE 6 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 + \ Exit For Loop If '302' in '''${out}''' + \ Sleep 10s + Log To Console ${rc} + Log To Console ${out} + Should Contain ${out} 302 diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index a46d73fc32..8b0f252d78 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -91,7 +91,8 @@ Global Setup With Complete OVA Installation # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub - Set Global Variable ${EXPLICIT_WAIT} 60 + Set Global Variable ${EXPLICIT_WAIT} 30 + Set Global Variable ${EXTRA_EXPLICIT_WAIT} 60 Set Global Variable ${PRIMARY_PORT} 8282 Set Global Variable ${GS_PAGE_PORT} 9443 Set Global Variable ${HARBOR_PORT} 443 diff --git a/tests/resources/page-objects/Remove-Host-Modal-Util.robot b/tests/resources/page-objects/Remove-Host-Modal-Util.robot index 3d589ef8d0..b3f75f45e4 100644 --- a/tests/resources/page-objects/Remove-Host-Modal-Util.robot +++ b/tests/resources/page-objects/Remove-Host-Modal-Util.robot @@ -30,4 +30,4 @@ Verify Modal for Remove Container Host Click Remove On Remove Container Host Click Button ${rch-button-remove} - Wait Until Page Does Not Contain Element ${rch-button-remove} timeout=${EXPLICIT_WAIT} \ No newline at end of file + Wait Until Page Does Not Contain Element ${rch-button-remove} timeout=${EXTRA_EXPLICIT_WAIT} \ No newline at end of file diff --git a/tests/test-cases/Group2-Getting-Started/2-01-Getting-Started.robot b/tests/test-cases/Group2-Getting-Started/2-01-Getting-Started.robot index 79ae626bbe..358ac1fe6e 100644 --- a/tests/test-cases/Group2-Getting-Started/2-01-Getting-Started.robot +++ b/tests/test-cases/Group2-Getting-Started/2-01-Getting-Started.robot @@ -19,8 +19,6 @@ Test Timeout 10 minutes Test Setup Open Firefox Browser Test Teardown Close All Browsers -*** Keywords *** - *** Test Cases *** Verify Getting Started page Navigate To Getting Started Page diff --git a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot index df40cd8f9e..d5a92bdf5d 100644 --- a/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot +++ b/tests/test-cases/Group3-Admiral/3-01-Admiral-UI.robot @@ -27,15 +27,6 @@ ${cp-card-status-stopped} STOPPED *** Keywords *** Setup Base State - Log To Console \nWaiting for Admiral to come up... - :FOR ${i} IN RANGE 6 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 - \ Exit For Loop If '302' in '''${out}''' - \ Sleep 10s - Log To Console ${rc} - Log To Console ${out} - Should Contain ${out} 302 - Open Firefox Browser Navigate To VIC UI Home Page Login On Single Sign-On Page diff --git a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot index c7efe60aa8..978a1a05cf 100644 --- a/tests/test-cases/Group4-Harbor/4-01-Harbor.robot +++ b/tests/test-cases/Group4-Harbor/4-01-Harbor.robot @@ -27,15 +27,6 @@ ${card-status-stopped} STOPPED *** Keywords *** Setup Base State - Log To Console \nWaiting for Harbor to come up... - :FOR ${i} IN RANGE 6 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 - \ Exit For Loop If '302' in '''${out}''' - \ Sleep 10s - Log To Console ${rc} - Log To Console ${out} - Should Contain ${out} 302 - Open Firefox Browser Navigate To VIC UI Home Page Login On Single Sign-On Page From 21341f9bc7342b2426a2c4a8b7929bbbf8bbdfc8 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 10 Jan 2018 16:20:39 -0600 Subject: [PATCH 15/18] Run getting started registration during ova setup --- tests/common-ova/OVA-Setup.robot | 5 +++++ tests/resources/Util.robot | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/common-ova/OVA-Setup.robot b/tests/common-ova/OVA-Setup.robot index 0378aecc9c..fd38216509 100644 --- a/tests/common-ova/OVA-Setup.robot +++ b/tests/common-ova/OVA-Setup.robot @@ -25,4 +25,9 @@ ${default-ova-file-path} installer/bin/vic-*.ova *** Test Cases *** Install Common OVA Install Common OVA If Not Already ${default-ova-file-path} + # complete installation on UI + Set Browser Variables + Open Firefox Browser + Log In And Complete OVA Installation + Close All Browsers Wait for SSO Redirect \ No newline at end of file diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 8b0f252d78..6f415d9a54 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -88,6 +88,9 @@ Global Environment Setup Global Setup With Complete OVA Installation Global Environment Setup Set Test OVA IP If Available + Set Browser Variables + +Set Browser Variables # UI tests variables Set Global Variable ${FIREFOX_BROWSER} firefox Set Global Variable ${GRID_URL} http://127.0.0.1:4444/wd/hub @@ -103,10 +106,6 @@ Global Setup With Complete OVA Installation Set Global Variable ${HARBOR_URL} ${IP_URL}:${HARBOR_PORT} Set Global Variable ${DEFAULT_HARBOR_NAME} default-vic-registry Set Global Variable ${DEFAULT_HARBOR_PROJECT} default-project - # complete installation on UI - Open Firefox Browser - Log In And Complete OVA Installation - Close All Browsers Run command and Return output [Arguments] ${command} From e8a397220fdc79d8ce7a0f1e2694242c09cf05c9 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 10 Jan 2018 17:36:33 -0600 Subject: [PATCH 16/18] Add wait for online services in ova setup --- tests/common-ova/OVA-Setup.robot | 5 +++-- tests/resources/OVA-Util.robot | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tests/common-ova/OVA-Setup.robot b/tests/common-ova/OVA-Setup.robot index fd38216509..785daa84b5 100644 --- a/tests/common-ova/OVA-Setup.robot +++ b/tests/common-ova/OVA-Setup.robot @@ -25,9 +25,10 @@ ${default-ova-file-path} installer/bin/vic-*.ova *** Test Cases *** Install Common OVA Install Common OVA If Not Already ${default-ova-file-path} - # complete installation on UI + # validate complete installation on UI Set Browser Variables Open Firefox Browser Log In And Complete OVA Installation Close All Browsers - Wait for SSO Redirect \ No newline at end of file + # verify all services restarted after ui initialization + Wait for Online Components %{OVA_IP} \ No newline at end of file diff --git a/tests/resources/OVA-Util.robot b/tests/resources/OVA-Util.robot index 9bd5d42a98..52d54aaeb3 100644 --- a/tests/resources/OVA-Util.robot +++ b/tests/resources/OVA-Util.robot @@ -56,17 +56,7 @@ Install VIC Product OVA Log To Console ${out} Should Contain ${out} 200 - Log To Console ssh into appliance... - ${out}= Run sshpass -p ${OVA_PASSWORD_ROOT} ssh -o StrictHostKeyChecking\=no ${OVA_USERNAME_ROOT}@${ova-ip} - - Open Connection ${ova-ip} - Wait Until Keyword Succeeds 10x 5s Login ${OVA_USERNAME_ROOT} ${OVA_PASSWORD_ROOT} - - Wait Until Keyword Succeeds 10x 20s Check service running fileserver - Wait Until Keyword Succeeds 10x 20s Check service running admiral - Wait Until Keyword Succeeds 10x 20s Check service running harbor - - Close connection + Wait for Online Components ${ova-ip} [Return] ${ova-ip} @@ -96,10 +86,23 @@ Cleanup VIC Product OVA Run Keyword And Ignore Error Run GOVC datastore.rm /%{TEST_DATASTORE}/vm/${ova_target_vm_name} Run Keyword if ${rc}==0 Log To Console \nVIC Product OVA deployment ${ova_target_vm_name} is cleaned up on test server %{TEST_URL} -Wait for SSO Redirect +Wait for Online Components + [Arguments] ${ova-ip} + Log To Console ssh into appliance... + ${out}= Run sshpass -p ${OVA_PASSWORD_ROOT} ssh -o StrictHostKeyChecking\=no ${OVA_USERNAME_ROOT}@$${ova-ip} + + Open Connection ${ova-ip} + Wait Until Keyword Succeeds 10x 5s Login ${OVA_USERNAME_ROOT} ${OVA_PASSWORD_ROOT} + + Wait Until Keyword Succeeds 10x 20s Check service running fileserver + Wait Until Keyword Succeeds 10x 20s Check service running admiral + Wait Until Keyword Succeeds 10x 20s Check service running harbor + + Close connection + Log To Console \nWaiting for SSO redirect to come up... :FOR ${i} IN RANGE 6 - \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://%{OVA_IP}:8282 + \ ${rc} ${out}= Run And Return Rc And Output curl -k -w "\%{http_code}\\n" https://${ova-ip}:8282 \ Exit For Loop If '302' in '''${out}''' \ Sleep 10s Log To Console ${rc} From 6af5d48ebb46728ee294cc6064bda766be5b2512 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Wed, 10 Jan 2018 19:35:52 -0600 Subject: [PATCH 17/18] Add final log messages --- tests/common-ova/OVA-Setup.robot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/common-ova/OVA-Setup.robot b/tests/common-ova/OVA-Setup.robot index 785daa84b5..3c0141579e 100644 --- a/tests/common-ova/OVA-Setup.robot +++ b/tests/common-ova/OVA-Setup.robot @@ -24,11 +24,14 @@ ${default-ova-file-path} installer/bin/vic-*.ova *** Test Cases *** Install Common OVA + Log To Console Installing ova, enrolling psc, and checking online component status... Install Common OVA If Not Already ${default-ova-file-path} # validate complete installation on UI + Log To Console Initializing the OVA using the getting started ui... Set Browser Variables Open Firefox Browser Log In And Complete OVA Installation Close All Browsers # verify all services restarted after ui initialization + Log To Console Checking for online final component status... Wait for Online Components %{OVA_IP} \ No newline at end of file From 56bca58422fc9722a98b0e7c7367f85e3fe8bd8b Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 16 Jan 2018 16:27:12 -0600 Subject: [PATCH 18/18] Add get_token.service restart upon appliance reinit --- .../build/scripts/appliance/psc/reconfigure_token.service | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/installer/build/scripts/appliance/psc/reconfigure_token.service b/installer/build/scripts/appliance/psc/reconfigure_token.service index 2752c48d59..b59ab4019d 100644 --- a/installer/build/scripts/appliance/psc/reconfigure_token.service +++ b/installer/build/scripts/appliance/psc/reconfigure_token.service @@ -1,12 +1,13 @@ [Unit] -Description=PSC Get Token +Description=Refresh psc token and restart psc dependent components Documentation=http://github.com/vmware/vic-product/installer Requires=network-online.target vic-appliance-wait-psc-config.service After=network-online.target vic-appliance-wait-psc-config.service [Service] Type=oneshot -ExecStart=/usr/bin/systemctl --no-block restart admiral harbor +ExecStart=/usr/bin/systemctl restart get_token.service +ExecStartPost=/usr/bin/systemctl --no-block restart admiral harbor [Install] WantedBy=psc-ready.target