juju入门

Posted Michael2397

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了juju入门相关的知识,希望对你有一定的参考价值。

https://jujucharms.com/docs/1.25/config-LXC

Installation(Ubuntu)

#sudo add-apt-repository ppa:juju/stable  (我们使用1.25)
#sudo apt-get update && sudo apt-get install juju-core

Configuring

linux目录下有个配置文件;
    ~/.juju/environments.yaml
#juju generate-config

# This is the Juju config file, which you can use to specify multiple
# environments in which to deploy. See https://juju.ubuntu.com/docs
# for more information

# An environment configuration must always specify at least the
# following information:
# - name (to identify the environment)
# - type (to specify the provider)
# In the following example the name is "myenv" and type is "ec2".
# myenv:
#    type: ec2

# Values in <brackets> below need to be filled in by the user.
# Optional attributes are shown commented out, with
# a sample value or a value in <brackets>.

# There are several settings supported by all environments, all of which
# are optional and have specified default values. For more info, see the
# Juju documentation.

# The default environment is chosen when an environment is not
# specified using any of the following, in descending order of precedence:
#  1. -e or --environment command line parameter, passed after the command, e.g.
#     $ juju add-unit -e myenv myservice
#  2. By setting JUJU_ENV environment variable.
#  3. Using the juju switch command like this:
#     $ juju switch myenv
#

# You can control how Juju harvests machines by using the
# provisioner-harvest-mode setting. Harvesting is a process wherein
# Juju attempts to reclaim unused machines.
#
# Options are:
#
# Don\'t harvest any machines.
# provisioner-harvest-mode: none
#
# Only harvest machines that Juju knows about and are dead.
# provisioner-harvest-mode: destroyed
#
# Only harvest machines that Juju doesn\'t know about.
# provisioner-harvest-mode: unknown
#
# Harvest both dead and unknown machines.
# provisioner-harvest-mode: all

default: amazon

environments:
    # https://juju.ubuntu.com/docs/config-local.html
    local:
        type: local
    
        # root-dir holds the directory that is used for the storage files and
        # database. The default location is $JUJU_HOME/<env-name>.
        # $JUJU_HOME defaults to ~/.juju. Override if needed.
        #
        # root-dir: ~/.juju/local
    
        # storage-port holds the port where the local provider starts the
        # HTTP file server. Override the value if you have multiple local
        # providers, or if the default port is used by another program.
        #
        # storage-port: 8040
    
        # network-bridge holds the name of the LXC network bridge to use.
        # Override if the default LXC network bridge is different.
        #
        #
        # network-bridge: lxcbr0
    
        # The default series to deploy the state-server and charms on.
        # Make sure to uncomment the following option and set the value to
        # precise or trusty as desired.
        #
        # default-series: trusty
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    
    gce:
      type: gce
    
      # Google Auth Info
      # The GCE provider uses OAuth to authenticate. This requires that
      # you set it up and get the relevant credentials. For more information
      # see https://cloud.google.com/compute/docs/api/how-tos/authorization.
      # The key information can be downloaded as a JSON file, or copied, from:
      #   https://console.developers.google.com/project/<projet>/apiui/credential
      # Either set the path to the downloaded JSON file here:
      auth-file:
    
      # ...or set the individual fields for the credentials. Either way, all
      # three of these are required and have specific meaning to GCE.
      # private-key:
      # client-email:
      # client-id:
    
      # Google instance info
      # To provision instances and perform related operations, the provider
      # will need to know which GCE project to use and into which region to
      # provision. While the region has a default, the project ID is
      # required. For information on the project ID, see
      # https://cloud.google.com/compute/docs/projects and regarding regions
      # see https://cloud.google.com/compute/docs/zones.
      project-id:
      # region: us-central1
    
      # The GCE provider uses pre-built images when provisioning instances.
      # You can customize the location in which to find them with the
      # image-endpoint setting. The default value is the a location within
      # GCE, so it will give you the best speed when bootstrapping or adding
      # machines. For more information on the image cache see
      # https://cloud-images.ubuntu.com/.
      # image-endpoint: https://www.googleapis.com
    joyent:
      type: joyent
    
      # SDC config
      # Can be set via env variables, or specified here
      # sdc-user: <secret>
      # Can be set via env variables, or specified here
      # sdc-key-id: <secret>
      # url defaults to us-west-1 DC, override if required
      # sdc-url: https://us-west-1.api.joyentcloud.com
    
      # Manta config
      # Can be set via env variables, or specified here
      # manta-user: <secret>
      # Can be set via env variables, or specified here
      # manta-key-id: <secret>
      # url defaults to us-east DC, override if required
      # manta-url: https://us-east.manta.joyent.com
    
      # Auth config
      # private-key-path is the private key used to sign Joyent requests.
      # Alternatively, you can supply "private-key" with the content of the private
      # key instead supplying the path to a file.
      # private-key-path: ~/.ssh/foo_id
      # algorithm defaults to rsa-sha256, override if required
      # algorithm: rsa-sha256
    
      # Whether or not to refresh the list of available updates for an
      # OS. The default option of true is recommended for use in
      # production systems, but disabling this can speed up local
      # deployments for development or testing.
      #
      # enable-os-refresh-update: true
    
      # Whether or not to perform OS upgrades when machines are
      # provisioned. The default option of true is recommended for use
      # in production systems, but disabling this can speed up local
      # deployments for development or testing.
      #
      # enable-os-upgrade: true
    
    # https://juju.ubuntu.com/docs/config-maas.html
    maas:
        type: maas
    
        # maas-server specifies the location of the MAAS server. It must
        # specify the base path.
        #
        maas-server: \'http://192.168.1.1/MAAS/\'
    
        # maas-oauth holds the OAuth credentials from MAAS.
        #
        maas-oauth: \'<add your OAuth credentials from MAAS here>\'
    
        # maas-server bootstrap ssh connection options
        #
    
        # bootstrap-timeout time to wait contacting a state server, in seconds.
        bootstrap-timeout: 1800
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    
    
    
    manual:
        type: manual
        # bootstrap-host holds the host name of the machine where the
        # bootstrap machine agent will be started.
        bootstrap-host: somehost.example.com
    
        # bootstrap-user specifies the user to authenticate as when
        # connecting to the bootstrap machine. It defaults to
        # the current user.
        # bootstrap-user: joebloggs
    
        # storage-listen-ip specifies the IP address that the
        # bootstrap machine\'s Juju storage server will listen
        # on. By default, storage will be served on all
        # network interfaces.
        # storage-listen-ip:
    
        # storage-port specifes the TCP port that the
        # bootstrap machine\'s Juju storage server will listen
        # on. It defaults to 8040
        # storage-port: 8040
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of false is set so that Juju
        # does not subsume any other way the system might be
        # maintained.
        #
        # enable-os-upgrade: false
    
    vmware:
      type: vsphere
    
      # IP address or DNS name of vsphere API host.
      host:
    
      # Vsphere API user credentials.
      user:
      password:
    
      # Name of vsphere datacenter.
      datacenter:
    
      # Name of the network, that all created vms will use ot obtain public ip address. 
      # This network should have ip pool configured or DHCP server connected to it.
      # This parameter is optional. 
      extenal-network:
    # https://juju.ubuntu.com/docs/config-azure.html
    azure:
        type: azure
    
        # location specifies the place where instances will be started,
        # for example: West US, North Europe.
        #
        location: West US
    
        # The following attributes specify Windows Azure Management
        # information. See:
        # http://msdn.microsoft.com/en-us/library/windowsazure
        # for details.
        #
        management-subscription-id: 00000000-0000-0000-0000-000000000000
        management-certificate-path: /home/me/azure.pem
    
        # storage-account-name holds Windows Azure Storage info.
        #
        storage-account-name: abcdefghijkl
    
        # force-image-name overrides the OS image selection to use a fixed
        # image for all deployments. Most useful for developers.
        #
        # force-image-name: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-13_10-amd64-server-DEVELOPMENT-20130713-Juju_ALPHA-en-us-30GB
    
        # image-stream chooses a simplestreams stream from which to select
        # OS images, for example daily or released images (or any other stream
        # available on simplestreams).
        #
        # image-stream: "released"
    
        # agent-stream chooses a simplestreams stream from which to select tools,
        # for example released or proposed tools (or any other stream available
        # on simplestreams).
        #
        # agent-stream: "released"
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    
    # https://juju.ubuntu.com/docs/config-cloudsigma.html
    cloudsigma:
        type: cloudsigma
    
        # region holds the cloudsigma region (zrh, lvs, ...).
        #
        # region: <your region>
    
        # credentials for CloudSigma account
        #
        # username: <your username>
        # password: <secret>
    # https://juju.ubuntu.com/docs/config-aws.html
    amazon:
        type: ec2
    
        # region specifies the EC2 region. It defaults to us-east-1.
        #
        # region: us-east-1
    
        # access-key holds the EC2 access key. It defaults to the
        # environment variable AWS_ACCESS_KEY_ID.
        #
        # access-key: <secret>
    
        # secret-key holds the EC2 secret key. It defaults to the
        # environment variable AWS_SECRET_ACCESS_KEY.
        #
        # secret-key: <secret>
    
        # image-stream chooses a simplestreams stream from which to select
        # OS images, for example daily or released images (or any other stream
        # available on simplestreams).
        #
        # image-stream: "released"
    
        # agent-stream chooses a simplestreams stream from which to select tools,
        # for example released or proposed tools (or any other stream available
        # on simplestreams).
        #
        # agent-stream: "released"
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    
    # https://juju.ubuntu.com/docs/config-openstack.html
    openstack:
        type: openstack
    
        # use-floating-ip specifies whether a floating IP address is
        # required to give the nodes a public IP address. Some
        # installations assign public IP addresses by default without
        # requiring a floating IP address.
        #
        # use-floating-ip: false
    
        # use-default-secgroup specifies whether new machine instances
        # should have the "default" Openstack security group assigned.
        #
        # use-default-secgroup: false
    
        # network specifies the network label or uuid to bring machines up
        # on, in the case where multiple networks exist. It may be omitted
        # otherwise.
        #
        # network: <your network label or uuid>
    
        # agent-metadata-url specifies the location of the Juju tools and
        # metadata. It defaults to the global public tools metadata
        # location https://streams.canonical.com/tools.
        #
        # agent-metadata-url:  https://your-agent-metadata-url
    
        # image-metadata-url specifies the location of Ubuntu cloud image
        # metadata. It defaults to the global public image metadata
        # location https://cloud-images.ubuntu.com/releases.
        #
        # image-metadata-url:  https://your-image-metadata-url
    
        # image-stream chooses a simplestreams stream from which to select
        # OS images, for example daily or released images (or any other stream
        # available on simplestreams).
        #
        # image-stream: "released"
    
        # agent-stream chooses a simplestreams stream from which to select tools,
        # for example released or proposed tools (or any other stream available
        # on simplestreams).
        #
        # agent-stream: "released"
    
        # auth-url defaults to the value of the environment variable
        # OS_AUTH_URL, but can be specified here.
        #
        # auth-url: https://yourkeystoneurl:443/v2.0/
    
        # tenant-name holds the openstack tenant name. It defaults to the
        # environment variable OS_TENANT_NAME.
        #
        # tenant-name: <your tenant name>
    
        # region holds the openstack region. It defaults to the
        # environment variable OS_REGION_NAME.
        #
        # region: <your region>
    
        # The auth-mode, username and password attributes are used for
        # userpass authentication (the default).
        #
        # auth-mode holds the authentication mode. For user-password
        # authentication, auth-mode should be "userpass" and username and
        # password should be set appropriately; they default to the
        # environment variables OS_USERNAME and OS_PASSWORD respectively.
        #
        # auth-mode: userpass
        # username: <your username>
        # password: <secret>
    
        # For key-pair authentication, auth-mode should be "keypair" and
        # access-key and secret-key should be set appropriately; they
        # default to the environment variables OS_ACCESS_KEY and
        # OS_SECRET_KEY respectively.
        #
        # auth-mode: keypair
        # access-key: <secret>
        # secret-key: <secret>
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    
    # https://juju.ubuntu.com/docs/config-hpcloud.html
    hpcloud:
        type: openstack
    
        # use-floating-ip specifies whether a floating IP address is
        # required to give the nodes a public IP address. Some
        # installations assign public IP addresses by default without
        # requiring a floating IP address.
        #
        # use-floating-ip: true
    
        # use-default-secgroup specifies whether new machine instances
        # should have the "default" Openstack security group assigned.
        #
        # use-default-secgroup: false
    
        # tenant-name holds the openstack tenant name. In HPCloud, this is
        # synonymous with the project-name It defaults to the environment
        # variable OS_TENANT_NAME.
        #
        # tenant-name: <your tenant name>
    
        # image-stream chooses a simplestreams stream from which to select
        # OS images, for example daily or released images (or any other stream
        # available on simplestreams).
        #
        # image-stream: "released"
    
        # agent-stream chooses a simplestreams stream from which to select tools,
        # for example released or proposed tools (or any other stream available
        # on simplestreams).
        #
        # agent-stream: "released"
    
        # auth-url holds the keystone url for authentication. It defaults
        # to the value of the environment variable OS_AUTH_URL.
        #
        # auth-url: https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/
    
        # region holds the cloud region (e.g. region-a.geo-1). It
        # defaults to the environment variable OS_REGION_NAME.
        #
        # region: <your region>
    
        # auth-mode holds the authentication mode. For user-password
        # authentication, auth-mode should be "userpass" and username and
        # password should be set appropriately; they default to the
        # environment variables OS_USERNAME and OS_PASSWORD respectively.
        #
        # auth-mode: userpass
        # username: <your_username>
        # password: <your_password>
    
        # For key-pair authentication, auth-mode should be "keypair" and
        # access-key and secret-key should be set appropriately; they
        # default to the environment variables OS_ACCESS_KEY and
        # OS_SECRET_KEY respectively.
        #
        # auth-mode: keypair
        # access-key: <secret>
        # secret-key: <secret>
    
        # Whether or not to refresh the list of available updates for an
        # OS. The default option of true is recommended for use in
        # production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-refresh-update: true
    
        # Whether or not to perform OS upgrades when machines are
        # provisioned. The default option of true is recommended for use
        # in production systems, but disabling this can speed up local
        # deployments for development or testing.
        #
        # enable-os-upgrade: true
    

 

#juju bootstrap(注意这里要跟一个集群)

 

 

 

  

以上是关于juju入门的主要内容,如果未能解决你的问题,请参考以下文章

一份golang令牌桶攻略(juju/ratelimit)

JuJu团队11月30号工作汇报

JuJu团队1月2号工作汇报

JuJu团队1月7号工作汇报

JuJu团队1月10号工作汇报

问题解决HOST_JUJU_LOCK_PERMISSION 。。