====== JuJu ====== JuJu is an orchestration tool developed by Canonical. By utilizing JuJu it's possible to deploy and represent services from bare-metal (e.g. OpenStack) to application level (e.g. Owncloud), hence JuJu operates on the three major [[https://en.wikipedia.org/wiki/Cloud_computing#Service_models|cloud service models]]: PaaS (Platform as a Service), IaaS (Infrastructure as a Service) and SaaS (Software as a Sevice). These services can be modeled and scaled not only using the comprehensive command line interface (CLI), but also by a ready-to-use graphical user interface (GUI). Due to JuJu's interoperability, it can be utilized within different cloud providers like Amazon Web Services, Microsoft Azure and OpenStack. This allows users to move models quickly between different cloud environments. To deploy, integrate, scale and expose services one can provide so called Charms (e.g. MySQL). Furthermore, Charms can be combined via Bundles to represent relationships within different services (e.g. Owncloud plus attached database). Prebuilt Charms and Bundles can be found in a public accessible [[https://jujucharms.com/store|store]]. Unlike [[https://docs.openstack.org/developer/heat/index.html|Heat]], JuJu is less integrated into OpenStack and deployments work only with Ubuntu, whereas already an experimental [[https://jujucharms.com/docs/2.0/juju-centos|CentOS support]] exists. ====== Connect to BCF cloud ====== > Tested with JuJu version 2.0 ===== Preperation ===== In order to connect JuJu to the BCF cloud, prepare a virtual machine (VM) as described [[cloud:first_steps|here]]. Issuing the following command should list all available images: user@cb-pc08:~$ openstack image list +--------------------------------------+------------------------------------------+--------+ | ID | Name | Status | +--------------------------------------+------------------------------------------+--------+ | 0f49eaf2-c366-43de-87ba-665ecb953c05 | Ubuntu_14.04_trusty | active | | 0ad51ebe-4225-40f5-8048-a8744b9ea4fd | fedora-20.x86_64 | active | | 02fcf9f0-787f-44bb-9c0c-fc377c775e8b | centos_7 | active | | d653054f-86f6-4567-a559-2119b2a78d80 | RancherOS | active | +--------------------------------------+------------------------------------------+--------+ All of the below-mentioned steps assuming a prepared Ubuntu Trusty (14.04) image, which can be created by executing the command below. Read [[cloud:image_builder|here]] for a detailed instruction of building disk images and how to upload an image via the OpenStack CLI into the BCF cloud user@cb-pc08:~$ DIB_RELEASE=trusty disk-image-create -a amd64 -o ubuntu-trusty.qcow ubuntu vm ===== Install JuJu ===== The first step is to install JuJu in the VM, from which you want to control your JuJu deployments (Ubuntu 14.04 or later). Since JuJu is already part of the official package repository of recent versions of Ubuntu, the command below is sufficient: user@cb-pc08:~$ sudo apt-get install juju After the installation was successfully, one can determine the version of JuJu by issuing ''juju version'' (should display something like ''2.0.0-xenial-amd64''). JuJu already contains pre-installed, public cloud environments, which can be verified with the ''clouds'' command: user@cb-pc08:~$ juju clouds Cloud Regions Default Type Description aws 12 us-east-1 ec2 Amazon Web Services aws-china 1 cn-north-1 ec2 Amazon China aws-gov 1 us-gov-west-1 ec2 Amazon (USA Government) azure 18 centralus azure Microsoft Azure azure-china 2 chinaeast azure Microsoft Azure China cloudsigma 5 hnl cloudsigma CloudSigma Cloud google 4 us-east1 gce Google Cloud Platform joyent 6 eu-ams-1 joyent Joyent Cloud rackspace 6 dfw rackspace Rackspace Cloud localhost 1 localhost lxd LXD Container Hypervisor Furthermore, it's important to have the following variables in your environment, since JuJu needs them to have access to the right tenant and user name of your OpenStack project: export OS_TENANT_NAME=$OS_PROJECT_NAME export OS_DOMAIN_NAME=$OS_USER_DOMAIN_NAME ===== Create metadata image ===== This step is necessary to create the metadata of an image. The data consists of endpoint, region, image ID and so forth. It is needed to provide JuJu all necessary information for the later creation of the controller. user@cb-pc08:~$ juju metadata generate-image -d ~/metadata \ -i 2a3f51cf-c7dc-4364-9b17-458bd23c0aba \ -s trusty \ -r BCF \ -u $OS_AUTH_URL ^ Flag ^ Description ^ | -d | The directory where the metadata will be placed. Must exist. | | -i | The image ID. Issue ''openstack image list'' to retrieve the respective ID. | | -s | Specifies the series (Trusty, Xenial, ...) of the image. | | -r | The region of the cloud. | | -u | The cloud endpoint. | ===== Create controller ===== From the [[https://jujucharms.com/docs/2.0/controllers|JuJu documentation]]: >A Juju controller is the management node of a Juju cloud environment. In particular, it houses the database and keeps track of all the models in that environment. Although it is a special node, it is a machine that gets created by Juju (during the "bootstrap" stage) and, in that sense, is similar to other Juju machines. Once all necessary steps in order to prepare the JuJu environment are done, one can start to create a controller by pasting the following lines into a file, e.g. called ''bcf_openstack.yaml''. This information is necessary to provide connection details to JuJu. clouds: bcfopenstack: type: openstack use-floating-ip: true regions: BCF: endpoint: https://www.computational.bio.uni-giessen.de:5000/v3 The following, self-explanatory command adds the BCF cloud to the list of the known clouds, whereas the name of the cloud (//bcfopenstack//) must match with cloud name provided in the recently create yaml file: user@cb-pc08:~$ juju add-cloud bcfopenstack bcf_openstack.yaml Verify a successful addition (notice the last line): user@cb-pc08:~$ juju clouds Cloud Regions Default Type Description aws 12 us-east-1 ec2 Amazon Web Services aws-china 1 cn-north-1 ec2 Amazon China aws-gov 1 us-gov-west-1 ec2 Amazon (USA Government) azure 18 centralus azure Microsoft Azure azure-china 2 chinaeast azure Microsoft Azure China cloudsigma 5 hnl cloudsigma CloudSigma Cloud google 4 us-east1 gce Google Cloud Platform joyent 6 eu-ams-1 joyent Joyent Cloud rackspace 6 dfw rackspace Rackspace Cloud localhost 1 localhost lxd LXD Container Hypervisor bcfopenstack 1 BCF openstack Openstack Cloud Now add your credentials by issuing the command below. user@cb-pc08:~$ juju autoload-credentials In case this command doesn't work, be sure that especially ''openstack image list'' lists all images, ''OS_DOMAIN_NAME'' is set to //bcf//, ''OS_TENANT_NAME'' is set to your projects name and ''bcf_openstack.yaml'' is correct. Finally, create the controller in the following way. The location of the metadata source must match with the directory which have been used to store the metadata. user@cb-pc08:~$ juju bootstrap --metadata-source metadata --bootstrap-series="trusty" Afterwards you will ask to (1) specify a cloud name and (2) to set a controller name. The latter can be chosen freely, but the cloud name must match with the cloud name specified in the yaml file, //bcfopenstack// in the present case. ====== Set up JuJu GUI ====== To set up a JuJu GUI, simply trigger ''juju deploy cs:trusty/juju-gui-142'' and expose the GUI via executing ''juju expose juju-gui''. You must assign a floating IP to the instance where the GUI is running. Simply enter the floating IP into your browser to access the GUI from everywhere. The necessary credentials can be viewed via: user@cb-pc08:~$ juju gui --show-credentials ====== Deploy a service ====== A service deployment can be achieved similar like the JuJu GUI in the latter step. Basically the deployment procedure is divided into two steps. First, choose a service from the charm store and issue the following command to deploy a [[https://jujucharms.com/wiki-scalable/|scalable wiki]] bundle: user@cb-pc08:~$ juju deploy wiki-scalable Second expose the service via: user@cb-pc08:~$ juju expose loadbalancer The GUI can be utilized to deploy and expose the wiki in a very easy way graphically. No matter, how you deploy and expose a service you have to **assign a floating IP** to get outside access to your application. Read the [[https://jujucharms.com/docs/stable/charms-deploying|docs]] to get more information about deploying services. ====== Delete a service ====== To learn how to delete a service, consider [[https://jujucharms.com/docs/2.1/charms-destroy|this]] docu entry. ====== More ====== The present introduction is very sketchy. Please read the official documentation, which can be found [[https://jujucharms.com/docs/2.0/getting-started|here]] to learn more.