From 16f88d964d5edb9ad5ac223d3c07303629dae418 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Fri, 3 Mar 2023 08:59:52 -0500 Subject: [PATCH] Working. Clams integration stop. --- defaults.sh | 2 +- deployment/cluster.sh | 5 ++++- deployment/create_lxc_base.sh | 7 +++--- deployment/deploy_vms.sh | 2 +- deployment/stub_lxc_profile.sh | 41 +++++++++++++++++++--------------- deployment/www/deploy_clams.sh | 1 + install.sh | 2 +- management/provision.sh | 2 +- 8 files changed, 36 insertions(+), 26 deletions(-) diff --git a/defaults.sh b/defaults.sh index f6ddc3a..032e05a 100755 --- a/defaults.sh +++ b/defaults.sh @@ -80,7 +80,7 @@ export PROJECTS_DIR="$HOME/ss-projects" export SITES_PATH="$HOME/ss-sites" # The base VM image. -export LXD_UBUNTU_BASE_VERSION="22.04" +export LXD_UBUNTU_BASE_VERSION="jammy" export BASE_IMAGE_VM_NAME="ss-base-${LXD_UBUNTU_BASE_VERSION//./-}" export BASE_LXC_IMAGE="ubuntu/$LXD_UBUNTU_BASE_VERSION/cloud" export UBUNTU_BASE_IMAGE_NAME="ss-ubuntu-${LXD_UBUNTU_BASE_VERSION//./-}" diff --git a/deployment/cluster.sh b/deployment/cluster.sh index 8edf5b1..5494dd4 100755 --- a/deployment/cluster.sh +++ b/deployment/cluster.sh @@ -87,6 +87,9 @@ if ! lxc remote list | grep -q "$CLUSTER_NAME"; then esac done + # first let's copy our ssh pubkey to the remote server so we don't have to login constantly. + ssh-copy-id -i "$HOME/.ssh/id_rsa.pub" "ubuntu@$FQDN" + if [ -z "$DATA_PLANE_MACVLAN_INTERFACE" ]; then echo "INFO: It looks like you didn't provide input on the command line for the data plane macvlan interface." echo " We need to know which interface that is! Enter it here now." @@ -159,7 +162,7 @@ sudo apt-get update && sudo apt-get upgrade -y && sudo apt install htop dnsutils # install lxd as a snap if it's not installed. if ! snap list | grep -q lxd; then - sudo snap install lxd + sudo snap install lxd --channel=5.10/stable sleep 10 fi " diff --git a/deployment/create_lxc_base.sh b/deployment/create_lxc_base.sh index 1e773d6..848477a 100755 --- a/deployment/create_lxc_base.sh +++ b/deployment/create_lxc_base.sh @@ -17,7 +17,7 @@ fi # If the lxc VM does exist, then we will delete it (so we can start fresh) if lxc list -q --format csv | grep -q "$BASE_IMAGE_VM_NAME"; then # if there's no snapshot, we dispense with the old image and try again. - if ! lxc info "$BASE_IMAGE_VM_NAME" | grep -q "ss-docker-$(date +%Y-%m)"; then + if ! lxc info "$BASE_IMAGE_VM_NAME" | grep -q "ss-docker-$LXD_UBUNTU_BASE_VERSION"; then lxc delete "$BASE_IMAGE_VM_NAME" --force ssh-keygen -f "$SSH_HOME/known_hosts" -R "$BASE_IMAGE_VM_NAME" fi @@ -31,12 +31,13 @@ else lxc start "$BASE_IMAGE_VM_NAME" - sleep 70 + sleep 30 # ensure the ssh service is listening at localhost lxc exec "$BASE_IMAGE_VM_NAME" -- wait-for-it 127.0.0.1:22 -t 120 + # stop the VM and get a snapshot. lxc stop "$BASE_IMAGE_VM_NAME" - lxc snapshot "$BASE_IMAGE_VM_NAME" "ss-docker-$(date +%Y-%m)" + lxc snapshot "$BASE_IMAGE_VM_NAME" "ss-docker-$LXD_UBUNTU_BASE_VERSION" fi diff --git a/deployment/deploy_vms.sh b/deployment/deploy_vms.sh index 4bd6be1..e881186 100755 --- a/deployment/deploy_vms.sh +++ b/deployment/deploy_vms.sh @@ -33,7 +33,7 @@ if ! lxc list --format csv | grep -q "$LXD_VM_NAME"; then ./stub_lxc_profile.sh "$LXD_VM_NAME" - lxc copy --profile="$LXD_VM_NAME" "$BASE_IMAGE_VM_NAME"/"ss-docker-$(date +%Y-%m)" "$LXD_VM_NAME" + lxc copy --profile="$LXD_VM_NAME" "$BASE_IMAGE_VM_NAME"/"ss-docker-$LXD_UBUNTU_BASE_VERSION" "$LXD_VM_NAME" # now let's create a new VM to work with. #@lxc init --profile="$LXD_VM_NAME" "$BASE_IMAGE_VM_NAME" "$LXD_VM_NAME" --vm diff --git a/deployment/stub_lxc_profile.sh b/deployment/stub_lxc_profile.sh index 2d554c8..66460f2 100755 --- a/deployment/stub_lxc_profile.sh +++ b/deployment/stub_lxc_profile.sh @@ -50,12 +50,6 @@ if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then preserve_hostname: false fqdn: ${BASE_IMAGE_VM_NAME} - apt: - sources: - docker.list: - source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable" - keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 - packages: - curl - ssh-askpass @@ -76,10 +70,6 @@ if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then - wait-for-it - dnsutils - wget - - docker-ce - - docker-ce-cli - - containerd.io - - docker-compose-plugin groups: - docker @@ -104,18 +94,33 @@ if [ "$LXD_HOSTNAME" = "$BASE_IMAGE_VM_NAME" ]; then UsePAM no LogLevel INFO - - path: /etc/docker/daemon.json - content: | - { - "registry-mirrors": ["${REGISTRY_URL}"] - } - runcmd: + - sudo mkdir -m 0755 -p /etc/apt/keyrings + - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list + - sudo apt-get update + - sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - sudo apt-get install -y openssh-server EOF -#, -#"labels": [ "githead=${LATEST_GIT_COMMIT}" ] + + + # apt: + # sources: + # docker.list: + # source: "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${LXD_UBUNTU_BASE_VERSION} stable" + # keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 + + # - path: /etc/docker/daemon.json + # content: | + # { + # "registry-mirrors": ["${REGISTRY_URL}"], + # "labels": [ "githead=${LATEST_GIT_COMMIT}" ] + # } + + +# - sudo apt-get update + #- sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin else # all other machines. diff --git a/deployment/www/deploy_clams.sh b/deployment/www/deploy_clams.sh index 54c7ab1..99e6b50 100755 --- a/deployment/www/deploy_clams.sh +++ b/deployment/www/deploy_clams.sh @@ -10,6 +10,7 @@ if [ "$DEPLOY_BTCPAY_SERVER" = true ]; then git clone "$CLAMS_GIT_REPO" "$LOCAL_CLAMS_REPO_PATH" else cd "$LOCAL_CLAMS_REPO_PATH" + #git config pull.ff only git pull cd - fi diff --git a/install.sh b/install.sh index d2bce62..e3e043f 100755 --- a/install.sh +++ b/install.sh @@ -24,7 +24,7 @@ fi # install snap if ! snap list | grep -q lxd; then - sudo snap install lxd --channel=5.11/candidate + sudo snap install lxd --channel=5.10/stable sleep 3 # run lxd init on the remote server./dev/nvme1n1 diff --git a/management/provision.sh b/management/provision.sh index 061ee42..070de0d 100755 --- a/management/provision.sh +++ b/management/provision.sh @@ -34,7 +34,7 @@ sleep 1 # install snap if ! snap list | grep -q lxd; then - sudo snap install lxd + sudo snap install lxd --channel=5.10/stable sleep 6 # We just do an auto initialization. All we are using is the LXD client inside the management environment.