forked from getredash/setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packer.json
89 lines (89 loc) · 2.3 KB
/
packer.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
"variables": {
"image_version": ""
},
"builders": [
{
"name": "redash-us-east-1",
"type": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-0ac019f4fcb7cb7e6",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "redash-{{user `image_version`}}-us-east-1"
},
{
"type": "googlecompute",
"project_id": "redash-bird-123",
"source_image_family": "ubuntu-1804-lts",
"zone": "us-central1-a",
"ssh_username": "arik"
},
{
"type": "digitalocean",
"image": "ubuntu-18-04-x64",
"region": "nyc3",
"size": "1gb",
"ssh_username": "root",
"snapshot_name": "redash-{{user `image_version`}}-{{timestamp}}"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["sleep 30"]
},
{
"type": "shell",
"script": "setup.sh",
"execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
},
{
"type": "shell",
"inline": "sudo rm /root/.ssh/authorized_keys || true"
},
{
"type": "shell",
"inline": "sudo rm /home/ubuntu/.ssh/authorized_keys || true"
},
{
"type": "file",
"source": "data/generate_key.sh",
"destination": "/tmp/rc.local"
},
{
"type": "file",
"source": "data/docker-compose-up.service",
"destination": "/tmp/docker-compose-up.service"
},
{
"type": "shell",
"inline": [
"sudo mv /tmp/rc.local /etc/rc.local",
"sudo chown root /etc/rc.local",
"sudo chmod 755 /etc/rc.local",
"sudo mv /tmp/docker-compose-up.service /etc/systemd/system/docker-compose-up.service",
"sudo chown root /etc/systemd/system/docker-compose-up.service",
"sudo systemctl enable docker-compose-up"
]
},
{
"type": "shell",
"script": "data/cleanup.sh",
"execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
},
{
"type": "shell",
"script": "data/do_img_checks.sh",
"execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
}
],
"post-processors": [
{
"type": "googlecompute-export",
"only": ["googlecompute"],
"paths": ["gs://redash-images/redash.{{user `image_version`}}.tar.gz"],
"keep_input_artifact": true
}
]
}