github.com/sentienttechnologies/studio-go-runner@v0.0.0-20201118202441-6d21f2ced8ee/cloud/azure/rabbitmq/README.md (about)

     1  # Azure deployment
     2  
     3  Change the user-data file to contain your generated or preferred SSH administration key, in this case of this example we pasted in the contents of the $HOME/.ssh/id_ed25519.pub file into the user-data file as an item inside the ssh-authorized-keys yaml block.  You can run the following command to generate a key if you are not sure that you have one really.
     4  
     5  ```shell
     6  echo "n" | ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
     7  export PUBLIC_KEY=`cat ~/.ssh/id_ed25519.pub`
     8  ```
     9  
    10  You will also need to define environment variables to specify the RMQ_ADMIN_PASSWORD, and RMQ_USER_PASSWORD as environment variables.  These should be protected secrets that you choose and will need to pass to anyone wishing to upload and download data on this server.
    11  
    12  ```shell
    13  storage_account=`echo -e "bootlogs$(uuidgen | md5sum - | cut -c1-8)"`
    14  export RMQ_ADMIN_PASSWORD=[A secret key you choose and is secret to the administrator]
    15  export RMQ_USER_PASSWORD=[A secret key you choose and is secret to users of StudioML, or LEAF]
    16  envsubst < user-data > user-data-$storage_account
    17  az login --use-device-code
    18  az group create --name rabbitMQ --location eastus
    19  az storage account create --resource-group rabbitMQ --name $storage_account  --sku standard_lrs
    20  az vm create --name rabbitMQ --resource-group rabbitMQ --location eastus --os-disk-size-gb 128 --boot-diagnostics-storage $storage_account --authentication-type ssh --generate-ssh-keys --image Canonical:UbuntuServer:18.04-LTS:latest --public-ip-address-allocation static --size Standard_D4s_v3 --custom-data user-data-$storage_account -o none
    21  export RMQ_ADDRESS=$(az network public-ip list --resource-group rabbitMQ --query "[].ipAddress" --output tsv)
    22  
    23  az vm open-port --port 15672 --resource-group rabbitMQ --name rabbitMQ --priority 500
    24  az vm open-port --port 5672 --resource-group rabbitMQ --name rabbitMQ --priority 501
    25  ```
    26  
    27  ## Shell access
    28  ssh ubuntu@$RMQ_ADDRESS -i ~/.ssh/id_ed25519
    29  
    30  ## Diagnostics
    31  
    32  az vm boot-diagnostics get-boot-log --ids $(az vm list -g rabbitMQ --query "[].id" -o tsv)
    33  
    34  # Testing
    35  
    36  Validating the cloud-init schema
    37  
    38  cloud-init devel schema --config-file user-data
    39  
    40  
    41  https://blog.simos.info/how-to-preconfigure-lxd-containers-with-cloud-init/
    42  
    43  lxc profile copy default devprofile
    44  lxc profile show devprofile
    45  
    46  lxc profile set devprofile user.user-data "$( cat user-data )"
    47  
    48  lxc launch --profile devprofile ubuntu:18.04 junk
    49  
    50  lxc file pull junk/var/log/cloud-init.log -
    51  
    52  lxc delete junk --force
    53