From c646368aa2dbeb97a7ead490605422a811d05b75 Mon Sep 17 00:00:00 2001 From: Jason Morris Date: Tue, 16 Jan 2018 20:52:10 -0600 Subject: [PATCH] Appliance systemd overhaul (#1300) Make a variety of changes to the systemd configuration of the vic-product appliance, including: - Improved serviceability and linear boot dependencies. - A new custom boot target and new target for psc config. - Adds a psc reconfiguration target accommodating changes in system configuration over time. - Improved adherence to systemd best practices. Fixes #1215, #1265, and #1267. --- installer/DESIGN.md | 3 + installer/build/ova-manifest.json | 630 +++++++++--------- .../scripts/admiral/add_default_users.sh | 2 + .../{systemd => }/admiral/admiral.service | 12 +- .../scripts/admiral/configure_admiral.sh | 5 +- .../scripts/{systemd => appliance}/boot.local | 0 .../{systemd => appliance}/dcui_override.conf | 0 .../appliance/get_vic_appliance_logs.sh | 2 - .../appliance/load-docker-images.sh | 2 + .../mounts}/repartition.service | 2 +- .../mounts}/resizefs.service | 3 +- .../mounts/storage-data.mount | 2 +- .../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 | 4 +- .../psc/get_token.timer | 0 .../scripts/appliance/psc/psc-ready.target | 9 + .../appliance/psc/reconfigure_token.path | 9 + .../appliance/psc/reconfigure_token.service | 13 + .../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 | 8 +- .../appliance/vic-appliance-environment.sh | 0 .../vic-appliance-load-docker-images.service | 6 +- .../vic-appliance-ready.target | 14 +- .../scripts/appliance/vic-appliance.target | 8 + .../build/scripts/appliance/wait_for_file.sh | 10 + .../fileserver/fileserver.service | 7 +- .../build/scripts/harbor/configure_harbor.sh | 6 +- installer/build/scripts/harbor/harbor.service | 20 + .../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 +- .../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 | 20 +- .../configure_vic_machine_server.sh | 0 .../vic-machine-server-logrotate | 0 .../vic_machine_server.service | 4 +- installer/fileserver/tasks.go | 7 - tests/common-ova/OVA-Setup.robot | 14 +- tests/resources/OVA-Util.robot | 27 +- tests/resources/Util.robot | 17 +- .../Group1-OVA-Install/1-01-Install.md | 16 +- .../Group1-OVA-Install/1-01-Install.robot | 20 - .../2-01-Getting-Started.robot | 2 - 71 files changed, 525 insertions(+), 589 deletions(-) rename installer/build/scripts/{systemd => }/admiral/admiral.service (50%) 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 (89%) 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 (84%) rename installer/build/scripts/{systemd => appliance}/psc/get_token.service (53%) rename installer/build/scripts/{ => appliance}/psc/get_token.sh (91%) 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/reconfigure_token.path create mode 100644 installer/build/scripts/appliance/psc/reconfigure_token.service 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 (57%) 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 => appliance}/vic-appliance-ready.target (53%) create mode 100644 installer/build/scripts/appliance/vic-appliance.target create mode 100755 installer/build/scripts/appliance/wait_for_file.sh rename installer/build/scripts/{systemd => }/fileserver/fileserver.service (61%) 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 (87%) 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 (94%) diff --git a/installer/DESIGN.md b/installer/DESIGN.md index a48c74e5e3..124d33cda1 100644 --- a/installer/DESIGN.md +++ b/installer/DESIGN.md @@ -61,6 +61,9 @@ _TODO_ Add reference service to repo 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/ova-manifest.json b/installer/build/ova-manifest.json index a38d1e2088..884b413de9 100644 --- a/installer/build/ova-manifest.json +++ b/installer/build/ova-manifest.json @@ -1,321 +1,311 @@ [ - { - "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/vic-appliance-ready.target", + "destination": "/usr/lib/systemd/system/vic-appliance-ready.target" + }, + { + "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/ovf-network.service", + "destination": "/usr/lib/systemd/system/ovf-network.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": "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": "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" + }, + { + "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": "shell", + "script": "scripts/provisioners/system_settings.sh" + } +] \ No newline at end of file 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/installer/build/scripts/systemd/admiral/admiral.service b/installer/build/scripts/admiral/admiral.service similarity index 50% rename from installer/build/scripts/systemd/admiral/admiral.service rename to installer/build/scripts/admiral/admiral.service index c31c601e27..d36c68b550 100644 --- a/installer/build/scripts/systemd/admiral/admiral.service +++ b/installer/build/scripts/admiral/admiral.service @@ -1,16 +1,20 @@ [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 +After=vic-appliance-ready.target psc-ready.target +Requires=vic-appliance-ready.target psc-ready.target [Service] Type=simple Restart=on-failure -RestartSec=5 +RestartSec=15 +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 ExecStop=/usr/bin/docker stop vic-admiral ExecStopPost=/usr/bin/docker rm vic-admiral [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance.target \ 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..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 startup." -systemctl enable admiral_startup.service -echo "Services enabled. exiting..." +echo "Configuration finished. exiting..." \ 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/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/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 89% rename from installer/build/scripts/systemd/mounts/storage-data.mount rename to installer/build/scripts/appliance/mounts/storage-data.mount index dfc1afc21d..6b9a4045d0 100644 --- a/installer/build/scripts/systemd/mounts/storage-data.mount +++ b/installer/build/scripts/appliance/mounts/storage-data.mount @@ -10,4 +10,4 @@ Where=/storage/data Type=ext4 [Install] -RequiredBy=local-fs.target +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..fdfc4e46ca --- /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-ready.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 84% rename from installer/build/scripts/systemd/network/ovf-network.service rename to installer/build/scripts/appliance/network/ovf-network.service index 8323e883ee..5c21296502 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-ready.target diff --git a/installer/build/scripts/systemd/psc/get_token.service b/installer/build/scripts/appliance/psc/get_token.service similarity index 53% rename from installer/build/scripts/systemd/psc/get_token.service rename to installer/build/scripts/appliance/psc/get_token.service index 3546e29989..ee2ec3e9f5 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=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/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 91% rename from installer/build/scripts/psc/get_token.sh rename to installer/build/scripts/appliance/psc/get_token.sh index 5b70d78aec..d41217e036 100755 --- a/installer/build/scripts/psc/get_token.sh +++ b/installer/build/scripts/appliance/psc/get_token.sh @@ -31,6 +31,4 @@ 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 +cp /etc/vmware/psc/harbor/tokens.properties /storage/data/harbor/psc/tokens.properties \ No newline at end of file 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/reconfigure_token.path b/installer/build/scripts/appliance/psc/reconfigure_token.path new file mode 100644 index 0000000000..d10b15f91e --- /dev/null +++ b/installer/build/scripts/appliance/psc/reconfigure_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/reconfigure_token.service b/installer/build/scripts/appliance/psc/reconfigure_token.service new file mode 100644 index 0000000000..b59ab4019d --- /dev/null +++ b/installer/build/scripts/appliance/psc/reconfigure_token.service @@ -0,0 +1,13 @@ +[Unit] +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 restart get_token.service +ExecStartPost=/usr/bin/systemctl --no-block restart admiral harbor + +[Install] +WantedBy=psc-ready.target 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..f5c72af59d --- /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 +Before=get_token.service + +[Service] +Type=oneshot +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 57% rename from installer/build/scripts/systemd/appliance/vic-appliance-environment.service rename to installer/build/scripts/appliance/vic-appliance-environment.service index 16e6133635..b9dda7921d 100644 --- a/installer/build/scripts/systemd/appliance/vic-appliance-environment.service +++ b/installer/build/scripts/appliance/vic-appliance-environment.service @@ -1,14 +1,10 @@ [Unit] Description=VIC Appliance Environment Documentation=https://github.com/vmware/vic-product -After=vic-appliance.target -Requires=vic-appliance.target [Service] -Type=simple -Restart=on-failure -RestartSec=5 +Type=oneshot ExecStart=/etc/vmware/vic-appliance-environment.sh [Install] -WantedBy=multi-user.target +WantedBy=vic-appliance-ready.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-ready.target similarity index 53% rename from installer/build/scripts/systemd/vic-appliance-ready.target rename to installer/build/scripts/appliance/vic-appliance-ready.target index 781ca0640e..c520b8f68b 100644 --- a/installer/build/scripts/systemd/vic-appliance-ready.target +++ b/installer/build/scripts/appliance/vic-appliance-ready.target @@ -1,15 +1,15 @@ [Unit] -Description=System customization for VIC Appliance +Description=Target notifying dependent units that basic services are available. 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 +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 new file mode 100644 index 0000000000..2c5b35ca09 --- /dev/null +++ b/installer/build/scripts/appliance/vic-appliance.target @@ -0,0 +1,8 @@ +[Unit] +Description=System customization for VIC Appliance +Documentation=https://github.com/vmware/vic-product/blob/master/installer/DESIGN.md + +Requires=multi-user.target +After=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 new file mode 100755 index 0000000000..8cdf973adb --- /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=30 # 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 61% rename from installer/build/scripts/systemd/fileserver/fileserver.service rename to installer/build/scripts/fileserver/fileserver.service index 80b755c6bf..32c2faef6f 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 +After=vic-appliance-ready.target Requires=vic-appliance-ready.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/configure_harbor.sh b/installer/build/scripts/harbor/configure_harbor.sh index a3d84e30ce..10a6204827 100755 --- a/installer/build/scripts/harbor/configure_harbor.sh +++ b/installer/build/scripts/harbor/configure_harbor.sh @@ -153,9 +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 startup" -systemctl enable harbor_startup.service - # 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 new file mode 100644 index 0000000000..b017e65377 --- /dev/null +++ b/installer/build/scripts/harbor/harbor.service @@ -0,0 +1,20 @@ +[Unit] +Description=Harbor Container Registry +Documentation=http://github.com/vmware/harbor +After=vic-appliance-ready.target psc-ready.target admiral.service +Requires=vic-appliance-ready.target psc-ready.target + +[Service] +Type=simple +Restart=on-failure +RestartSec=15 +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 87% rename from installer/build/scripts/system_settings.sh rename to installer/build/scripts/provisioners/system_settings.sh index d8f4164816..7f8288042c 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-ready.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 reconfigure_token.path 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_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..852d79f564 100755 --- a/installer/build/scripts/upgrade/upgrade.sh +++ b/installer/build/scripts/upgrade/upgrade.sh @@ -77,20 +77,20 @@ 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 + echo "Disabling and stopping Admiral and Harbor" | tee /dev/fd/3 + 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_startup.path - systemctl enable harbor_startup.path - systemctl start admiral_startup.path - systemctl start harbor_startup.path + echo "Enabling and starting Admiral and Harbor" | tee /dev/fd/3 + 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 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 94% 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..2671337eac 100644 --- a/installer/build/scripts/systemd/vic_machine_server/vic_machine_server.service +++ b/installer/build/scripts/vic_machine_server/vic_machine_server.service @@ -7,7 +7,7 @@ Requires=vic-appliance-ready.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 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", diff --git a/tests/common-ova/OVA-Setup.robot b/tests/common-ova/OVA-Setup.robot index 97f336636d..3c0141579e 100644 --- a/tests/common-ova/OVA-Setup.robot +++ b/tests/common-ova/OVA-Setup.robot @@ -21,9 +21,17 @@ 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 + 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 diff --git a/tests/resources/OVA-Util.robot b/tests/resources/OVA-Util.robot index dbfab8bf72..52d54aaeb3 100644 --- a/tests/resources/OVA-Util.robot +++ b/tests/resources/OVA-Util.robot @@ -56,6 +56,8 @@ Install VIC Product OVA Log To Console ${out} Should Contain ${out} 200 + Wait for Online Components ${ova-ip} + [Return] ${ova-ip} Install Common OVA If Not Already @@ -82,4 +84,27 @@ 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 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 + \ 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 9e419fe2f2..6f415d9a54 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -88,11 +88,14 @@ 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 Set Global Variable ${EXPLICIT_WAIT} 30 - Set Global Variable ${EXTRA_EXPLICIT_WAIT} 50 + 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 @@ -103,14 +106,16 @@ 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} ${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/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} 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