Compare commits
14 Commits
Author | SHA1 | Date |
---|---|---|
dependabot[bot] | 49d82360c4 | |
dependabot[bot] | 0c82ac600d | |
dependabot[bot] | 2603ce10c8 | |
dependabot[bot] | 16a8d0662f | |
Moritz Heiber | 364fbbc399 | |
Moritz Heiber | 469f5782e0 | |
Dani | 8e1be24f20 | |
Moritz Heiber | ba46cdb7e7 | |
Moritz Heiber | fe1db06d40 | |
Moritz Heiber | 4855aad63e | |
Moritz Heiber | fc14259402 | |
Moritz Heiber | 0f79a7aa51 | |
Moritz Heiber | e88594891d | |
Moritz Heiber | 18b4a8d8b2 |
|
@ -1,3 +1,4 @@
|
|||
/builds
|
||||
/packer_cache
|
||||
/.vagrant
|
||||
/output-virtualbox-iso
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "ansible"]
|
||||
path = ansible
|
||||
url = https://github.com/tootsuite/mastodon-ansible.git
|
||||
url = https://github.com/tootsuite/mastodon-ansible
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright © 2017 Moritz Heiber <hello@heiber.im>
|
||||
Copyright © 2017-2018 Moritz Heiber <hello@heiber.im>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
|
16
README.md
16
README.md
|
@ -1,6 +1,6 @@
|
|||
# A VirtualBox image for Mastodon development
|
||||
|
||||
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).
|
||||
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). It's made available through [Hashicorp's Vagrant Cloud](https://app.vagrantup.com) at [`mastodon/ubuntu-xenial64`](https://app.vagrantup.com/mastodon/boxes/ubuntu-xenial64).
|
||||
|
||||
_Note: Some of the content of the scripts in `scripts/` is borrowed from the [Bento](https://github.com/chef/bento) project._
|
||||
|
||||
|
@ -13,7 +13,7 @@ _Note: Some of the content of the scripts in `scripts/` is borrowed from the [Be
|
|||
|
||||
for testing purposes:
|
||||
|
||||
- Vagrant >= 1.9.3
|
||||
- Vagrant >= 2.0.3
|
||||
|
||||
## Setup
|
||||
|
||||
|
@ -23,7 +23,7 @@ $ source env/bin/activate
|
|||
$ pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Building the box
|
||||
## Building the box locally
|
||||
|
||||
Just execute:
|
||||
|
||||
|
@ -37,9 +37,15 @@ This will preseed the Ubuntu ISO image for Ubuntu Xenial 64bit with a couple of
|
|||
|
||||
In the end you should have a box in `builds/` with all the required components installed you can run directly in Vagrant.
|
||||
|
||||
## Submitting to Atlas
|
||||
## Publishing to Vagrant Cloud
|
||||
|
||||
tbd
|
||||
_Note: You need a valid access token to submit new versions of the box to Vagrant Cloud. It will not work otherwise. There is a organization called `mastodon` which is responsible for the Vagrant boxes under the same namespace. If you think you can/want to contribute send me a message on @moritzheiber@mastodon.social and I'll add your to the organization._
|
||||
|
||||
If you have a valid `VAGRANT_CLOUD_TOKEN` you can use the `vagrant-cloud` post-processor to upload a new version to Vagrant Cloud. It'll be done automatically if the token is set:
|
||||
|
||||
```
|
||||
$ VAGRANT_CLOUD_TOKEN="my-token" packer build packer.json
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
localhost ansible_connection=local
|
68
packer.json
68
packer.json
|
@ -4,6 +4,15 @@
|
|||
"password": "vagrant"
|
||||
},
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sudo apt-get update -qq",
|
||||
"sudo apt-get install -y git-core python-pip python-apt libffi-dev libssl-dev build-essential python-virtualenv python-setuptools",
|
||||
"mkdir -p /tmp/mastodon",
|
||||
"git clone https://github.com/tootsuite/mastodon-ansible /tmp/mastodon/ansible"
|
||||
]
|
||||
},
|
||||
{ "type": "shell",
|
||||
"inline": [
|
||||
"install -m0700 -o {{user `user`}} -g {{user `user`}} -d /home/{{user `user`}}/.ssh",
|
||||
|
@ -20,22 +29,30 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "ansible/playbook.yml",
|
||||
"extra_arguments": [ "--extra-vars", "mastodon_db_password=CHANGEME" ],
|
||||
"ansible_env_vars": [
|
||||
"ANSIBLE_REMOTE_TEMP=\"~/.ansible-tmp\"",
|
||||
"ANSIBLE_SSH_PIPELINING=True"
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"virtualenv venv",
|
||||
". venv/bin/activate",
|
||||
"pip install --upgrade ansible==2.2.2.0"
|
||||
]
|
||||
},
|
||||
{ "type": "shell",
|
||||
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
||||
"script": "scripts/clean.sh"
|
||||
{
|
||||
"type": "file",
|
||||
"source": "config/ansible.hosts",
|
||||
"destination": "/tmp/mastodon/ansible.hosts"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"environment_vars": ["ANSIBLE_REMOTE_TEMP=\"/tmp/mastodon/.ansible-tmp\"", "ANSIBLE_SSH_PIPELINING=True" ],
|
||||
"inline": [
|
||||
". venv/bin/activate",
|
||||
"ansible-playbook -i /tmp/mastodon/ansible.hosts -v -b --extra-vars mastodon_db_password=CHANGEME /tmp/mastodon/ansible/bare/playbook.yml"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
|
||||
"script": "scripts/minimize.sh"
|
||||
"scripts": ["scripts/clean.sh", "scripts/minimize.sh"]
|
||||
}
|
||||
],
|
||||
"builders": [
|
||||
|
@ -52,13 +69,13 @@
|
|||
" console-setup/layoutcode=us ",
|
||||
" console-setup/modelcode=pc105 ",
|
||||
" debconf/frontend=noninteractive ",
|
||||
" debian-installer=en_US ",
|
||||
" debian-installer=en_US.UTF-8 ",
|
||||
" fb=false ",
|
||||
" initrd=/install/initrd.gz ",
|
||||
" kbd-chooser/method=us ",
|
||||
" keyboard-configuration/layout=USA ",
|
||||
" keyboard-configuration/variant=USA ",
|
||||
" locale=en_US ",
|
||||
" locale=en_US.UTF-8 ",
|
||||
" netcfg/get_domain=vm ",
|
||||
" netcfg/get_hostname=vagrant ",
|
||||
" grub-installer/bootdev=/dev/sda ",
|
||||
|
@ -72,11 +89,11 @@
|
|||
"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_urls": "http://releases.ubuntu.com/16.04/ubuntu-16.04.4-server-amd64.iso",
|
||||
"iso_checksum_type": "sha256",
|
||||
"iso_checksum": "737ae7041212c628de5751d15c3016058b0e833fdc32e7420209b76ca3d0a535",
|
||||
"iso_checksum": "0a03608988cfd2e50567990dc8be96fb3c501e198e2e6efcb846d89efc7b89f2",
|
||||
"ssh_username": "{{user `user`}}",
|
||||
"ssh_password": "{{user `user`}}",
|
||||
"ssh_password": "{{user `password`}}",
|
||||
"ssh_wait_timeout": "20m",
|
||||
"shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now",
|
||||
"vm_name": "packer-ubuntu-16.04-amd64",
|
||||
|
@ -97,9 +114,20 @@
|
|||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"output": "builds/{{.Provider}}-mastodon-ubuntu1604.box",
|
||||
"type": "vagrant"
|
||||
}
|
||||
]
|
||||
[
|
||||
{
|
||||
"output": "builds/{{.Provider}}-mastodon-ubuntu1604.box",
|
||||
"type": "vagrant"
|
||||
},
|
||||
{
|
||||
"type": "vagrant-cloud",
|
||||
"box_tag": "mastodon/ubuntu-xenial64",
|
||||
"version": "0.5.{{timestamp}}"
|
||||
}
|
||||
]
|
||||
],
|
||||
"push": {
|
||||
"name": "mastodon/ubuntu-xenial64",
|
||||
"vcs": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
{
|
||||
"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\"}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -26,7 +26,7 @@ tasksel tasksel/first multiselect standard, ubuntu-server
|
|||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
d-i keyboard-configuration/modelcode string pc105
|
||||
d-i debian-installer/locale string en_US
|
||||
d-i debian-installer/locale string en_US.UTF-8
|
||||
|
||||
# Set the root password
|
||||
d-i passwd/root-login boolean true
|
||||
|
|
|
@ -1 +1 @@
|
|||
ansible==2.2.2.0
|
||||
ansible==4.2.0
|
||||
|
|
Loading…
Reference in New Issue