Skip to content

Conversation

@russellseymour
Copy link

Changes to the cookbook to allow Marketplace images to be created on the Alibaba platform.

As mentioned in chef-partners/omnibus-marketplace#93 packages need to b uploaded to the OSS service so that they can be downloaded without the danger of time out. A number of changes were required to the cookbook to support this and the Alibaba cloud. This will mean that when new version of Omnibus Marketplace, Automate and Chef Server are created they will need to be uploaded to OSS before a package can be created.

The kitchen file for Alibaba states that Packer version 1.0.4 is used. This version has the Alibaba provider contained within it. It is also now one binary instead of lots of little files.

A new attribute file for Alibaba (alibaba.rb) has been created that holds the necessary configuration. It was in this file that I tried to pass the URL for the software packages that are held in OSS, but it would not pass them through to the chef-marketplace cookbook as attributes.

There is also an attribute set here that states the URL for the Omnibus Marketplace debian file. There is a companion template install_marketplace_oss.sh.erb, but although I tried to pass in the URL as a variable in _publish.rb using the packer_provisioner resource it would not render properly hence why it is hardcode at the moment. (I really do not now why this was the case and I will try it again).

The necessary builders and products have been set for Alibaba, but in the case of the products only Automate has been configured.

The credentials for Alibaba can only be set as environment variables so this has been set in the _packer.rb file if a credential for Alibaba exists in the databag.

The format for the databag item for Alibaba is:

{
    "id": "publishing_credentials",
    "alibaba": {
        "access_key": "abcdefghijklm",
        "secret_key": "abcdefghijklm"
    }
}

I have created an image in Alibaba that has been created with this and the omnibus package.

'support_email' => '[email protected]',
'sales_email' => '[email protected]',
'reporting_cron_enabled' => false,
'doc_url' => 'https://docs.chef.io/aws_marketplace.html',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create an Alibaba site for this?

@jjasghar
Copy link

jjasghar commented Sep 7, 2017

How is the licence done here? Is it pulled in from the cookbook? Does it default to the 30 day Automate license?

Added URLs to download products to attributes. A new packer file is created so that the Omnibus marketplace recipe reads it in to get the URLs for download

Signed-off-by: Russell Seymour <[email protected]>
@russellseymour
Copy link
Author

@jjasghar Not sure about that at the moment. I think it will default to the 30 day license.

Still trying to work out how all of this hangs together.

@russellseymour
Copy link
Author

Added new packer_provisioner when building an image on the Alibaba platform that writes out a JSON file of the product URLs so that the omnibus_marketplace is able to download from OSS.

Signed-off-by: Russell Seymour <[email protected]>
packman:
version: 1.0.4
checksums:
"1.0.4": 646da085cbcb8c666474d500a44d933df533cf4f1ff286193d67b51372c3c59e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I think it's good that we're upgrading packer, I'd prefer to see the default version updated to 1.0.4 and breaking changes in other packer definitions fixed. We're tracking that work on: CLOUD-261 and CLOUD-262

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - did not want to assume upgrading the default version whilst I was getting the initial Alibaba work going

@@ -0,0 +1,56 @@
# frozen_string_literal: true
cred_dir = ::File.expand_path(::File.join('~', '.alibaba'))
credential_file = ::File.join(cred_dir, 'credentials')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably move the alibaba credentials into the same data_bag that has the Azure, GCP, and AWS creds.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used the same format as the data bag so it should just be a case of copying and paste from what I have. I do not know where the data bag for those is to update.

To get this working I used a local version of the data bag that kitchen could read.

default['marketplace_image']['alibaba']['public']['automate']['enabled'] = false

default['marketplace_image']['alibaba']['product_urls'] = {
'marketplace' => 'http://chef-software.oss-cn-beijing.aliyuncs.com/chef-marketplace_0.2.5%2B20170911103840.git.2.1c6a67f-1_amd64.deb',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that there's a firewall preventing the instance from accessing our package mirrors? Do we want to require the full URL or just the version of packages? What's the process of uploading a new package version to the Alibaba mirror? That should at least be documented.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a preventing of getting to mirrors, it is throttling. It is so slow to download that most of the time things time out.

At the moment we need the full URL to the package that needs to be downloaded. It was the simplest way I could think to get it working.

Currently it is a case of logging into the Alibaba cloud with the account in LastPass and manually uploading. There are command line tools that allow you to this but I have not investigated thoe yet.

'role' => 'automate',
'platform' => 'alibaba',
'user' => 'ubuntu',
'support_email' => '[email protected]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely don't want to use the aws alias for alibaba.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - my mistake I missed this.

Have changed it to [email protected] (although it will need creating on our side).

'support_email' => '[email protected]',
'sales_email' => '[email protected]',
'reporting_cron_enabled' => false,
'doc_url' => 'https://docs.chef.io/aws_marketplace.html',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably make this specific to alibaba as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have changed this to an Alibaba specific address - again it needs creating.

'sales_email' => '[email protected]',
'reporting_cron_enabled' => false,
'doc_url' => 'https://docs.chef.io/aws_marketplace.html',
'disable_outbound_traffic' => false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to set this to true. Right now there are several tools that expect to be able to hit outside mirrors. Since it appears that isn't the case we'll want to set this to true.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned its not that we cannot get to external mirrors, they are just very slow.

When using the Alibaba mirrored Ubuntu repos everything is OK, packages install as expected. This is the default in the images.

'reporting_cron_enabled' => false,
'doc_url' => 'https://docs.chef.io/aws_marketplace.html',
'disable_outbound_traffic' => false,
'license_type' => 'flexible',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fixed since we're not doing metered billing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified in latest changes

Signed-off-by: Russell Seymour <[email protected]>
Signed-off-by: Russell Seymour <[email protected]>
Signed-off-by: Russell Seymour <[email protected]>
Signed-off-by: Russell Seymour <[email protected]>
Changed URL for the marketplace image

Signed-off-by: Russell Seymour <[email protected]>
yzl pushed a commit that referenced this pull request Oct 11, 2017
* [CLOUD-262] packer > 0.10.1 uses its own `azure-arm` builder, obsoleting use of
the `packer-azure` plugin. This requires new azure builder attributes in
the `publishing_credentials.json` file.
* packer >= 1.0.1 supports alicloud, enabling
#43.

Signed-off-by: Yvonne Lam <[email protected]>
…n Alibaba

Added script to perform a dist-upgrade on Ubuntu 14.04

Signed-off-by: Russell Seymour <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants