Added Atlas configuration

This commit is contained in:
Moritz Heiber 2017-04-19 08:42:46 +02:00
parent 178c887e83
commit 44cc71d0b1
2 changed files with 112 additions and 3 deletions

View File

@ -1,8 +1,8 @@
# A VirtualBox box for Mastodon
# A VirtualBox image for Mastodon development
This VirtualBox base box contains all the required packages and configuration for running/instantiating a Mastodon instance. It is build using [Hashicorp's Packer](https://packer.io), the provisioning is done with Ansible through a dedicated git submodule called [mastodon-ansible](https://github.com/moritzheiber/mastodon-ansible). The tests are using [ServerSpec](https://serverspec.org).
This VirtualBox base image contains all the required packages and configuration for running/instantiating a Mastodon instance for development. It is build using [Hashicorp's Packer](https://packer.io), the provisioning is done with Ansible through a dedicated git submodule called [mastodon-ansible](https://github.com/moritzheiber/mastodon-ansible). The tests are using [ServerSpec](https://serverspec.org). The image is build continuously using [Hashicorp Atlas](https://atlas.hashicorp.com).
## Prerequisites
## Prerequisites (for building on your own)
- VirtualBox >= 5.1.x
- Packer >= 1.0.0

109
packer.json.atlas Normal file
View File

@ -0,0 +1,109 @@
{
"variables": {
"user": "vagrant",
"password": "vagrant",
"atlas_token": ""
},
"provisioners": [
{ "type": "shell",
"inline": [
"install -m0700 -o {{user `user`}} -g {{user `user`}} -d /home/{{user `user`}}/.ssh",
"curl -SsL https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o /home/{{user `user`}}/.ssh/authorized_keys"
]
},
{ "type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"mount -o loop ${HOME}/VBoxGuestAdditions.iso /mnt",
"/mnt/VBoxLinuxAdditions.run install",
"umount /mnt",
"rm ${HOME}/VBoxGuestAdditions.iso"
]
},
{
"type": "ansible",
"playbook_file": "ansible/playbook.yml"
},
{ "type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"script": "scripts/clean.sh"
},
{
"type": "shell",
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"script": "scripts/minimize.sh"
}
],
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"/install/vmlinuz ",
" auto ",
" console-setup/ask_detect=false ",
" console-setup/layoutcode=us ",
" console-setup/modelcode=pc105 ",
" debconf/frontend=noninteractive ",
" debian-installer=en_US ",
" fb=false ",
" initrd=/install/initrd.gz ",
" kbd-chooser/method=us ",
" keyboard-configuration/layout=USA ",
" keyboard-configuration/variant=USA ",
" locale=en_US ",
" netcfg/get_domain=vm ",
" netcfg/get_hostname=vagrant ",
" grub-installer/bootdev=/dev/sda ",
" noapic ",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
" -- <wait>",
"<enter><wait>"
],
"boot_wait": "10s",
"disk_size": 10000,
"guest_os_type": "Ubuntu_64",
"headless": true,
"http_directory": "preseeds",
"iso_urls": "http://releases.ubuntu.com/16.04/ubuntu-16.04.2-server-amd64.iso",
"iso_checksum_type": "sha256",
"iso_checksum": "737ae7041212c628de5751d15c3016058b0e833fdc32e7420209b76ca3d0a535",
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `user`}}",
"ssh_wait_timeout": "20m",
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
"vm_name": "packer-ubuntu-16.04-amd64",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"1024"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"1"
]
]
}
],
"post-processors": [
{
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "mastodon/ubuntu-xenial64",
"artifact_type": "vagrant.box",
"metadata": {
"created_at": "{{timestamp}}",
"description": "A Vagrant image for Mastodon development",
"provider": "virtualbox-iso",
"version": "{{isotime \"20060102T15_04_05\"}}"
}
}
]
}