-
 KDE-Apps.org Applications for the KDE-Desktop 
 GTK-Apps.org Applications using the GTK Toolkit 
 GnomeFiles.org Applications for GNOME 
 MeeGo-Central.org Applications for MeeGo 
 CLI-Apps.org Command Line Applications 
 Qt-Apps.org Free Qt Applications 
 Qt-Prop.org Proprietary Qt Applications 
 Maemo-Apps.org Applications for the Maemo Plattform 
 Java-Apps.org Free Java Applications 
 eyeOS-Apps.org Free eyeOS Applications 
 Wine-Apps.org Wine Applications 
 Server-Apps.org Server Applications 
 apps.ownCloud.com ownCloud Applications 
--
-
 KDE-Look.org Artwork for the KDE-Desktop 
 GNOME-Look.org Artwork for the GNOME-Desktop 
 Xfce-Look.org Artwork for the Xfce-Desktop 
 Box-Look.org Artwork for your Windowmanager 
 E17-Stuff.org Artwork for Enlightenment 
 Beryl-Themes.org Artwork for the Beryl Windowmanager 
 Compiz-Themes.org Artwork for the Compiz Windowmanager 
 EDE-Look.org Themes for your EDE Desktop 
--
-
 Debian-Art.org Stuff for Debian 
 Gentoo-Art.org Artwork for Gentoo Linux 
 SUSE-Art.org Artwork for openSUSE 
 Ubuntu-Art.org Artwork for Ubuntu 
 Kubuntu-Art.org Artwork for Kubuntu 
 LinuxMint-Art.org Artwork for Linux Mint 
 Arch-Stuff.org Art And Stuff for Arch Linux 
 Frugalware-Art.org Themes for Frugalware 
 Fedora-Art.org Artwork for Fedora Linux 
 Mandriva-Art.org Artwork for Mandriva Linux 
--
-
 KDE-Files.org Files for KDE Applications 
 OpenTemplate.org Documents for OpenOffice.org
 GIMPStuff.org Files for GIMP
 InkscapeStuff.org Files for Inkscape
 ScribusStuff.org Files for Scribus
 BlenderStuff.org Textures and Objects for Blender
 VLC-Addons.org Themes and Extensions for VLC
--
-
 KDE-Help.org Support for your KDE Desktop 
 GNOME-Help.org Support for your GNOME Desktop 
 Xfce-Help.org Support for your Xfce Desktop 
--
openDesktop.orgopenDesktop.org:   Applications   Artwork   Linux Distributions   Documents    Linux42.org    OpenSkillz.com   
 
Home
Apps
Artwork
News
Groups
Knowledge
Events
Forum
People
Jobs
Register
Login

-
- News . 
0
votes
click to vote up

Joe Liau: The Start of Charm: Another Guide for New Juju Charmers


Published Feb 1 2016 via RSS

let's start charminglet’s start charming

This is the basic blueprint of my system for juju charming. I found that this was the quickest and least problematic setup for myself.

Below is the guide to working with this setup. Most of this will apply for working with a local server as well.

While I was working on my first juju charm, I found that the documentation was quite helpful, but I also ran into some recurring issues. As a result, I curated a lot of content, and created notes, which are now in the form of a supplementary guide for those heading down a similar path.

WHAT THIS GUIDE WILL DO

  • Install and setup juju on a single, local desktop system for creating and testing charms
  • Give you basic terminal commands for working with juju
  • Give some tips for troubleshooting the juju environment

Follow the guide on the LEFT, and refer to the RIGHT when necessary.

Terminal commands in this guide will look like this.

Juju guide Troubleshooting
GET THE PPA READY

sudo add-apt-repository ppa:juju/stable
sudo apt-get update

SETUP THE LOCAL ENVIRONMENT

Install juju for local environment use:

sudo apt-get install juju-core juju-local
juju generate-config
juju switch local

BOOTSTRAP JUJU

juju bootstrap

The juju environment should be ready for working in now.

PREPARE LOCAL CHARM REPOSITORY

This guide will assume that you are working from the home directory, so please setup in home:

cd ~
mkdir -p charms/trusty
(swap “trusty” for “precise” if necessary)

You can now put charms that you are working on into ~/charms/trusty and deploy them via the local repository method (see below). Each charm will have its own unique directory that should match the charm name.

Install charm-tools for creating new charms, or testing existing ones:

sudo apt-get install charm-tools

Bootstrap Errors:
If you get any errors during bootstrap, then the environment is probably already boostrapped. You may need to restart the juju db and agent services. This might happen if you reboot the computer (you will notice that the juju commands just hang).

sudo service juju-db-$USER-local start
sudo service juju-agent-$USER-local start

Wait a few minutes for the agent to reconnect.

Destroying environment:

If the whole environment becomes messy or faulty, you can start over.

juju destroy-environment local
You will probably have to enter the super user password. And re-bootstrap.

In the worst case you might have to purge the juju installation and start again:
sudo apt-get purge juju*
sudo rm -rf ~/.juju

Some other errors might require a juju package upgrade.

USEFUL INFO COMMANDS

juju status

This will give you the details of what your current juju environment is doing.
Pay attention to public-address (IP), and current state of your charm. Don’t interact with it until it is “started”.

juju debug-log

A running log of whatever juju is doing. It will show you where charms are at, if there is an error, and when hooks are “completed.”
(You must CTRL C to get out of it.)

Status Checks:
It is important to be patient when checking on the status of charms. Some issues are resolved by waiting. You can check juju status periodically to see changes.

DEPLOYING SERVICES (i.e. “installing” charms)

a) You can deploy any “recommended” charm with:

juju deploy charmName

e.g. juju deploy juju-gui

You can deploy multiple charms without waiting for the previous one to finish.
Just don’t add relations until they are BOTH “started.”

b) If you want to deploy a charm that you are working on locally (one-line command):

juju deploy --repository=/home/$USER/charms/ local:trusty/charmname
e.g. juju deploy –repository=/home/$USER/charms/ local:trusty/diaspora

Replace “trusty” with “precise” if necessary.

c) You can also deploy from personal trunks that haven’t yet been recommended:

juju deploy cs:~launchpadUserId/trusty/charmname

e.g. juju deploy cs:~joe/trusty/ethercalc-6

d) Deploying from the GUI (see GUI section below)

Destroy services (i.e. charm installations):

Maybe you installed the wrong one, or it “failed” to install or configure.
(You should probably destroy relations first.)

juju destroy-service serviceName
e.g. juju destroy-service suitecrm

“Un-Dead” Services ( Can’t Destroy )

Sometimes things are “dying” forever, but don’t actually die because they are in an “error state.”

If a charm/relation is in an “error” state, it will hang indefinitely at each error. You can’t even destroy it.

You can “resolve” the errors until all the hooks have gone through the cycle at which point the thing may die.

juju resolved serviceName/0

e.g. juju resolved suitecrm/0

if you have more than one of the same service, the /# will indicate which one.

*Be sure to spell “resolved” correctly. I never get it right first type :(

ssh into a service (remember a service is running inside its own “machine” by default)

If you want to go into the virtual machine that your service is running on to fix/break things more:

juju ssh serviceName/0

e.g. juju ssh suitecrm/0

No username or password needed. You have root access with “sudo”. Keep track of where you are (purple circle vs orange circle). “exit” to return to the local terminal

RELATIONS

You can link/relate charms to each other if compatible. Commonly a database and another service.

juju add-relation charmName1 charmName2

WAIT again. Check the status do see “x-relation-changed” hook running etc.

Can’t add relation:

Check the charm’s readme to see if a special syntax is required for the relation.

Generally I like to wait for both services/charms to be in a ready state before adding a relation between them.

Destroy relations:

relation-changed hook failed, or the charms don’t like each other anymore:

juju destroy-relation charm1 charm2

e.g. juju destroy-relation suitecrm mysql

SAMPLE WORKFLOW: Deploying Services
Let’s see if that suitecrm charm is working for you.

Deploy database:

juju deploy mysql

Deploy suitecrm:

juju deploy suitecrm

Run juju status or juju debug-log to see when BOTH charms are done.

Just because it has a public-address does not mean that it’s ready to be used.

Add relation:

juju add-relation suitecrm mysql

Check status…… WAIT!

While you’re waiting… why not check out the readme document.

Access the service:

juju status and get the public-address of suitecrm, then visit in your browser. You should see the login page.

User: Admin
Pass: thisisaTEST!

GUI (OPTIONAL)

This will give you graphical way of working with juju. It is quite magical, but requires manual installation if not using juju-quickstart.

juju deploy juju-gui

WAIT. Do a “juju status” to see what stage of deployment is in.

Run this in your terminal again to get the admin password

cat ~/.juju/environments/local.jenv | grep password

Once started, copy the public-address. Usually 10.0.#.### and visit that in a browser. It will likely complain about an insecure connection. For our purposes you can add the exception.

Login with: admin and the password from the above command.

The GUI is the simplest way to deploy and manage services. It does not provide much debugging information at this time. Most of the usage is pretty self-explanatory.

When you deploy a service it will show the icon with colours to indicate its status (these have been varying lately):

Yellow = wait
Red = Stop. error…

You do have to “commit” the changes to the canvas.

your first charmyour first charm (source)

Hopefully this guide has provided you with an acceptable environment for working on your charm(s). Further documentation exists for starting a charm, but I also recommend finding an existing charm that is similar to the one that you want to create so that you can model the structure. More on this process can be seen in an earlier post.

Remember that you are not alone in this project: juju add-relation me community 😉



BackRead original postSend to a friend

Add comment

Add comment
Show all posts




-



 
 
 Who we are
Contact
More about us
Frequently Asked Questions
Register
Twitter
Blog
Explore
Apps
Artwork
Jobs
Knowledge
Events
People
Updates on identi.ca
Updates on Twitter
Content RSS   
Events RSS   

Participate
Groups
Forum
Add Content
Public API
About openDesktop.org
Legal Notice
Spreadshirt Shop
CafePress Shop
Advertising
Sponsor us
Report Abuse
 

Copyright 2007-2016 openDesktop.org Team  
All rights reserved. openDesktop.org is not liable for any content or goods on this site.
All contributors are responsible for the lawfulness of their uploads.
openDesktop is a trademark of the openDesktop.org Team