diff --git a/app/static/datapoint.seed b/app/static/datapoint.seed new file mode 100644 index 0000000..4da3cc2 --- /dev/null +++ b/app/static/datapoint.seed @@ -0,0 +1,147 @@ +################################################################################ +### Localization +################################################################################ + +d-i debian-installer/locale string en_US.UTF-8 +d-i localechooser/supported-locales multiselect en_US.UTF-8, de_DE.UTF-8 +d-i localechooser/translation/warn-light boolean true +d-i localechooser/translation/warn-severe boolean true +d-i console-setup/ask_detect boolean false +d-i keyboard-configuration/xkb-keymap select us + +################################################################################ +### Network configuration +################################################################################ + +d-i netcfg/choose_interface select auto +d-i netcfg/wireless_wep string +d-i netcfg/get_hostname string PRESEED +d-i netcfg/get_domain string lan + +################################################################################ +### Mirror settings +################################################################################ + +d-i mirror/country string manual +d-i mirror/http/hostname string bg.archive.ubuntu.com +d-i mirror/http/directory string /ubuntu +d-i mirror/http/proxy string +d-i mirror/http/mirror select bg.archive.ubuntu.com + +################################################################################ +### Clock and time zone setup +################################################################################ + +d-i clock-setup/utc boolean true +d-i time/zone string Europe/Sofia +d-i clock-setup/ntp boolean true +d-i clock-setup/ntp-server string time.apple.com + +################################################################################ +### Partitioning +################################################################################ + +#d-i preseed/early_command string umount /media || true +#d-i partman/unmount_active boolean true +d-i partman-auto/method string regular +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/device_remove_lvm_span boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/guided_size string max +d-i partman-auto-lvm/new_vg_name string workstation +d-i partman-auto/choose_recipe select atomic +d-i partman/default_filesystem string ext4 +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman-md/confirm boolean true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +################################################################################ +### Base system installation +################################################################################ + +#d-i base-installer/kernel/skip-install boolean true +d-i base-installer/install-recommends boolean true +d-i base-installer/kernel/image string linux-generic + +################################################################################ +### Account setup +################################################################################ + +d-i passwd/user-fullname string ubuntu-user +d-i passwd/username string ubuntu +d-i passwd/user-password-crypted password $6$HVqIDE43CsBb$JecrxJll8LUED03dz1KjS8Peek7dKVS0lR.1girEOGbh8XWh.cBFlpds9aREaDAptd8U5bLEW8ZOx8htjjPLr/ +d-i user-setup/allow-password-weak boolean true +d-i passwd/user-default-groups string sudo +d-i user-setup/encrypt-home boolean false + +################################################################################ +### Apt setup +################################################################################ + +d-i apt-setup/restricted boolean true +d-i apt-setup/universe boolean true +d-i apt-setup/backports boolean true +d-i apt-setup/use_mirror boolean false +d-i apt-setup/services-select multiselect security, updates +d-i apt-setup/security_host string security.ubuntu.com +d-i apt-setup/security_path string /ubuntu +#d-i apt-setup/extras boolean true + +################################################################################ +### Package selection +################################################################################ + +tasksel tasksel/first multiselect server + +# Individual additional packages to install +d-i pkgsel/include string \ + apt-transport-https \ + curl \ + openssh-server + +# see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1317602 +#d-i pkgsel/upgrade select none + +d-i pkgsel/language-packs multiselect de, en +d-i pkgsel/update-policy select unattended-upgrades + +################################################################################ +### Boot loader installation +################################################################################ + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true + +################################################################################ +### Finishing up the installation +################################################################################ + +d-i finish-install/reboot_in_progress note +d-i debian-installer/exit/poweroff boolean true + +################################################################################ +### X configuration +################################################################################ + +# Monitor autodetection is recommended. +xserver-xorg xserver-xorg/autodetect_monitor boolean true +# Uncomment if you have an LCD display. +xserver-xorg xserver-xorg/config/monitor/lcd boolean true +xserver-xorg xserver-xorg/config/monitor/selection-method select medium +xserver-xorg xserver-xorg/config/monitor/mode-list select 1024x768 @ 60 Hz + +################################################################################ +### Running custom commands during the installation +################################################################################ + +d-i preseed/late_command string in-target /bin/sh -c 'wget -q -O - https://www.datapoint.bg/static/datapoint.sh | bash' diff --git a/app/static/datapoint.sh b/app/static/datapoint.sh new file mode 100644 index 0000000..25bb22e --- /dev/null +++ b/app/static/datapoint.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +################################################################################ +## replace hostname with mac address +################################################################################ + +NET_DEVICE=$(ip r l scope global | awk '{print $5}') +NEW_HOSTNAME=$(ifconfig $NET_DEVICE | grep -oi '[0-9A-F]\{2\}\(:[0-9A-F]\{2\}\)\{5\}' | sed 's,:,,g') + +logger -t late-command "setting hostname to mac address" + +sed -i 's,PRESEED,'${NEW_HOSTNAME}',g' /etc/hosts +sed -i 's,PRESEED,'${NEW_HOSTNAME}',g' /etc/hostname + +################################################################################ +## grub options +################################################################################ + +sed -i 's,quiet splash,,' /etc/default/grub +update-grub + +################################################################################ +## install Docker +################################################################################ + +#curl -sSL https://get.docker.com/ | sh + +################################################################################ +## install Gitlab CI Multirunner +################################################################################ + +#curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | bash +#apt-get install gitlab-ci-multi-runner + +################################################################################ +## add gitlab-ci user to docker group +################################################################################ + +#usermod -aG docker gitlab-ci + +################################################################################ +## add some handy bash aliases +################################################################################ + +#cat > /etc/profile.d/docker.sh << EOF +#alias 'docker-clean-containers=docker rm $(docker ps -a -q)' +#alias 'docker-clean-images=docker rmi $(docker images -f "dangling=true" -q)' +#alias 'docker-clean-volumes=docker volume rm `docker volume ls -q -f dangling=true`' +#EOF + +################################################################################ +## force user gitlab-ci to change it's password +################################################################################ + +#chage -d 0 gitlab-ci diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py index b857649..0ea3a58 100644 --- a/app/vmanager/routes.py +++ b/app/vmanager/routes.py @@ -104,7 +104,6 @@ def vmcreate(orderid): db.session.commit() order.status = 'accepted' - db.session.update(order) db.session.commit() flash('A new deployment is created successfully in region "{}".'.format(str(order.region.description))) return redirect(url_for('panel.dashboard'))