./fastly-config <path to yaml> service-name (fastly|vcl) output-dir <username> <password>
./fastly-config.rb vcl-yml/service-name.yml "Service name" fastly vcl-gen [email protected] s3kr1tp4ssw0rd
./fastly-config.rb vcl-yml/service-name.yml "Service name" vcl vcl-gen
- fastly gem (v1.1.0+)
This provides a way to keep your fastly configs in source control. You specify your settings in a yaml file named like "service-name.yml", formatted like the example provided in vcl-yml in this directory, and it uses an erb template named "service-name-template.vcl.erb" in the vcl-templates directory to generate any needed vcl files.
There are two modes fastly-config.rb runs in. The 'fastly' operation uses the Fastly API to set up the configuration specified in the yml file, and uses the erb vcl template to generate a VCL file to upload, if specified in the yml file. When creating a new version of a service, it just creates an empty version from scratch and fills everything back in, rather than trying to update the old one.
The 'vcl' mode generates a full varnish 2.x file that can be dropped in and used to fulfill the CDN's functions should Fastly somehow utterly vanish from the face of the earth. An unlikely occurance, but it's best to be prepared. When generating the full vcl file, the username and password are not needed.
This should be relatively general, but some of the more obscure settings like gzip haven't been tested extensively.