Compare commits

...

14 Commits

Author SHA1 Message Date
dependabot[bot] 49d82360c4
Bump ansible from 2.10.7 to 4.2.0 (#5)
Bumps [ansible](https://github.com/ansible/ansible) from 2.10.7 to 4.2.0.
- [Release notes](https://github.com/ansible/ansible/releases)
- [Commits](https://github.com/ansible/ansible/commits)

---
updated-dependencies:
- dependency-name: ansible
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-14 15:54:53 +01:00
dependabot[bot] 0c82ac600d
Bump ansible from 2.10.0 to 2.10.7 (#4)
Bumps [ansible](https://github.com/ansible/ansible) from 2.10.0 to 2.10.7.
- [Release notes](https://github.com/ansible/ansible/releases)
- [Commits](https://github.com/ansible/ansible/compare/v2.10.0...v2.10.7)

---
updated-dependencies:
- dependency-name: ansible
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-08 11:13:36 +02:00
dependabot[bot] 2603ce10c8
Bump ansible from 2.6.18 to 2.10.0 (#3)
Bumps [ansible](https://github.com/ansible/ansible) from 2.6.18 to 2.10.0.
- [Release notes](https://github.com/ansible/ansible/releases)
- [Commits](https://github.com/ansible/ansible/compare/v2.6.18...v2.10.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-08 06:58:30 +02:00
dependabot[bot] 16a8d0662f Bump ansible from 2.2.2.0 to 2.6.18 (#2)
Bumps [ansible](https://github.com/ansible/community) from 2.2.2.0 to 2.6.18.
- [Release notes](https://github.com/ansible/community/releases)
- [Commits](https://github.com/ansible/community/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-12 21:03:41 +02:00
Moritz Heiber 364fbbc399 Updated to newest Packer definitions; removed Atlas integration (deprecated) 2018-04-22 12:02:18 +02:00
Moritz Heiber 469f5782e0 Merge pull request #1 from danipozodg/master
Update Ubuntu ISO URL and checksum
2017-10-24 09:42:47 +02:00
Dani 8e1be24f20 Update Ubuntu ISO URL and checksum 2017-10-15 17:52:36 +02:00
Moritz Heiber ba46cdb7e7 Try to work around some issues with the build 2017-05-24 13:28:28 +02:00
Moritz Heiber fe1db06d40 Trying to work around Packer Enterprise issues 2017-05-23 21:57:07 +02:00
Moritz Heiber 4855aad63e Syncing templates 2017-04-28 11:37:24 +02:00
Moritz Heiber fc14259402 Use an include statement to make Atlas happy, remove token reference (unused), properly initialize the submodule 2017-04-28 07:44:30 +02:00
Moritz Heiber 0f79a7aa51 Updated docs for Atlas again 2017-04-26 14:17:47 +02:00
Moritz Heiber e88594891d - Move packer.json to a non-default filename to avoid confusion
- Added documentation about Altas submissions
2017-04-26 09:16:33 +02:00
Moritz Heiber 18b4a8d8b2 Preparing the build env for Packer Enterprise 2017-04-26 06:46:04 +02:00
9 changed files with 65 additions and 138 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/builds
/packer_cache
/.vagrant
/output-virtualbox-iso

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "ansible"]
path = ansible
url = https://github.com/tootsuite/mastodon-ansible.git
url = https://github.com/tootsuite/mastodon-ansible

View File

@ -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

View File

@ -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

1
config/ansible.hosts Normal file
View File

@ -0,0 +1 @@
localhost ansible_connection=local

View File

@ -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
}
}

View File

@ -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\"}}"
}
}
]
}

View File

@ -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

View File

@ -1 +1 @@
ansible==2.2.2.0
ansible==4.2.0