2014-12-09 17:55:17 -05:00
|
|
|
---
|
2015-07-22 22:31:00 -04:00
|
|
|
description: |
|
2015-07-24 17:54:46 -04:00
|
|
|
The `packer push` command uploads a template and other required files to the
|
|
|
|
Atlas build service, which will run your packer build for you.
|
2015-07-22 22:31:00 -04:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Push - Command-Line'
|
|
|
|
...
|
2014-12-09 17:55:17 -05:00
|
|
|
|
2015-01-22 21:48:02 -05:00
|
|
|
# Command-Line: Push
|
2014-12-09 17:55:17 -05:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
The `packer push` command uploads a template and other required files to the
|
|
|
|
Atlas service, which will run your packer build for you. [Learn more about
|
|
|
|
Packer in Atlas.](https://atlas.hashicorp.com/help/packer/features)
|
2014-12-09 17:55:17 -05:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
Running builds remotely makes it easier to iterate on packer builds that are not
|
|
|
|
supported on your operating system, for example, building docker or QEMU while
|
|
|
|
developing on Mac or Windows. Also, the hard work of building VMs is offloaded
|
|
|
|
to dedicated servers with more CPU, memory, and network resources.
|
2014-12-09 17:55:17 -05:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
When you use push to run a build in Atlas, you may also want to store your build
|
|
|
|
artifacts in Atlas. In order to do that you will also need to configure the
|
|
|
|
[Atlas post-processor](/docs/post-processors/atlas.html). This is optional, and
|
|
|
|
both the post-processor and push commands can be used independently.
|
2015-02-03 18:32:57 -05:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
!> The push command uploads your template and other files, like provisioning
|
|
|
|
scripts, to Atlas. Take care not to upload files that you don't intend to, like
|
|
|
|
secrets or large binaries. **If you have secrets in your Packer template, you
|
|
|
|
should [move them into environment
|
2016-01-14 15:33:00 -05:00
|
|
|
variables](https://www.packer.io/docs/templates/user-variables.html).**
|
2015-07-23 03:02:18 -04:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
Most push behavior is [configured in your packer
|
|
|
|
template](/docs/templates/push.html). You can override or supplement your
|
|
|
|
configuration using the options below.
|
2014-12-09 17:55:17 -05:00
|
|
|
|
|
|
|
## Options
|
|
|
|
|
2015-07-23 03:02:18 -04:00
|
|
|
- `-token` - Your access token for the Atlas API.
|
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
-> Login to Atlas to [generate an Atlas
|
|
|
|
Token](https://atlas.hashicorp.com/settings/tokens). The most convenient way to
|
|
|
|
configure your token is to set it to the `ATLAS_TOKEN` environment variable, but
|
|
|
|
you can also use `-token` on the command line.
|
2015-02-03 17:37:55 -05:00
|
|
|
|
2015-07-22 23:25:58 -04:00
|
|
|
- `-name` - The name of the build in the service. This typically looks like
|
2015-07-24 17:54:46 -04:00
|
|
|
`hashicorp/precise64`, which follows the form `<username>/<buildname>`. This
|
|
|
|
must be specified here or in your template.
|
2015-07-23 03:02:18 -04:00
|
|
|
|
2015-07-24 17:54:46 -04:00
|
|
|
- `-var` - Set a variable in your packer template. This option can be used
|
|
|
|
multiple times. This is useful for setting version numbers for your build.
|
2015-07-23 03:02:18 -04:00
|
|
|
|
|
|
|
- `-var-file` - Set template variables from a file.
|
2015-04-15 15:53:57 -04:00
|
|
|
|
2015-02-03 17:37:55 -05:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Push a Packer template:
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
``` {.shell}
|
2015-10-27 21:35:37 -04:00
|
|
|
$ packer push template.json
|
2015-02-03 17:37:55 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
Push a Packer template with a custom token:
|
2014-12-09 17:55:17 -05:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
``` {.shell}
|
2015-02-03 17:37:55 -05:00
|
|
|
$ packer push -token ABCD1234 template.json
|
|
|
|
```
|
2015-07-28 19:24:43 -04:00
|
|
|
|
|
|
|
## Limits
|
|
|
|
|
|
|
|
`push` is limited to 5gb upload when pushing to Atlas. To be clear, packer *can*
|
|
|
|
build artifacts larger than 5gb, and Atlas *can* store artifacts larger than
|
|
|
|
5gb. However, the initial payload you push to *start* the build cannot exceed
|
|
|
|
5gb. If your boot ISO is larger than 5gb (for example if you are building OSX
|
|
|
|
images), you will need to put your boot ISO in an external web service and
|
|
|
|
download it during the packer run.
|
|
|
|
|
2015-07-30 18:58:12 -04:00
|
|
|
## Building Private `.iso` and `.dmg` Files
|
|
|
|
|
2015-07-30 19:09:40 -04:00
|
|
|
If you want to build a private `.iso` file you can upload the `.iso` to a secure
|
|
|
|
file hosting service like [Amazon
|
2016-01-14 15:31:19 -05:00
|
|
|
S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html),
|
2015-07-30 19:09:40 -04:00
|
|
|
[Google Cloud
|
|
|
|
Storage](https://cloud.google.com/storage/docs/gsutil/commands/signurl), or
|
|
|
|
[Azure File
|
|
|
|
Service](https://msdn.microsoft.com/en-us/library/azure/dn194274.aspx) and
|
|
|
|
download it at build time using a signed URL. You should convert `.dmg` files to
|
|
|
|
`.iso` and follow a similar procedure.
|
|
|
|
|
|
|
|
Once you have added [variables in your packer
|
|
|
|
template](/docs/templates/user-variables.html) you can specify credentials or
|
|
|
|
signed URLs using Atlas environment variables, or via the `-var` flag when you
|
|
|
|
run `push`.
|
2015-07-28 19:24:43 -04:00
|
|
|
|
|
|
|
![Configure your signed URL in the Atlas build variables
|
|
|
|
menu](/assets/images/packer-signed-urls.png)
|