summaryrefslogtreecommitdiffstats
path: root/scripts/c9-install
blob: d5bc537b4cf73dabc3f6e56b4d61f4d848eacf1c (plain)
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
90
91
92
93
94
95
96
#!/bin/bash

sudo apt update
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
SUDO="sudo env DEBIAN_FRONTEND=noninteractive"
$SUDO debconf-set-selections <<SELECTIONS
mysql-apt-config mysql-apt-config/select-server select mysql-5.7
mysql-apt-config mysql-apt-config/select-tools select
mysql-apt-config mysql-apt-config/unsupported-platform select ubuntu trusty
mysql-apt-config mysql-apt-config/repo-distro select ubuntu
mysql-apt-config mysql-apt-config/select-product select Apply
mysql-apt-config mysql-apt-config/enable-repo select mysql-5.7
mysql-apt-config mysql-apt-config/repo-codename select trusty
SELECTIONS
$SUDO dpkg -i mysql-apt-config_0.6.0-1_all.deb
$SUDO apt-get update
$SUDO apt-get install -y --force-yes mysql-server
$SUDO mysql_upgrade -u root --force
$SUDO apt-get install -y libgd-dev cpanminus libapache2-mod-perl2
$SUDO cpanm --installdeps --with-feature=bmo --notest .
$SUDO cpanm Linux::Pid
mysql-ctl restart
perl checksetup.pl
mysql -u root -e 'GRANT ALL on c9.* to '$C9_USER' IDENTIFIED BY "bugs"'
perl scripts/update_localconfig.pl db_user $C9_USER
perl scripts/update_localconfig.pl db_name c9
perl scripts/update_localconfig.pl db_pass 'bugs'
perl scripts/update_localconfig.pl webservergroup 'ubuntu'



cat > ~/checksetup_answers.txt <<'ANSWERS'
$answer{'ADMIN_EMAIL'}          = 'admin@mozilla.bugs';
$answer{'ADMIN_OK'}             = 'Y';
$answer{'ADMIN_PASSWORD'}       = 'bmo4c9rocks';
$answer{'ADMIN_REALNAME'}       = 'BMO Admin';
$answer{'NO_PAUSE'}             = 1;
$answer{'apache_size_limit'}    = 700000;
$answer{'bugzilla_version'}     = '1';
$answer{'create_htaccess'}      = '';
$answer{'diffpath'}             = '/usr/bin';
$answer{'index_html'}           = 0;
$answer{'interdiffbin'}         = '/usr/bin/interdiff';
$answer{'password_complexity'}  = 'bmo';
$answer{'user_info_class'}      = 'GitHubAuth,CGI';
$answer{'user_verify_class'}    = 'GitHubAuth,DB';
$answer{'memcached_namespace'}  = 'bmo:';
$answer{'memcached_servers'}    = '';
$answer{'use_mailer_queue'}     = 1;
$answer{'useclassification'}    = 1;
$answer{'usebugaliases'}        = 1;
$answer{'upgrade_notification'} = 0;
$answer{'usestatuswhiteboard'}  = 1;
$answer{'usetargetmilestone'}   = 1;
$answer{'webdotbase'}           = '/usr/bin/dot';
$answer{'auth_delegation'}      = 1;
$answer{'insidergroup'}         = 'admin';
$answer{'defaultpriority'}      = '--';
$answer{'defaultseverity'}      = 'normal';
$answer{'maxattachmentsize'}    = 4095;
$answer{'skin'} = 'Mozilla';
ANSWERS
sudo tee /etc/mysql/conf.d/max-packet.cnf <<CONF
[mysqld]
max_allowed_packet=10M
CONF
mysql-ctl restart
perl checksetup.pl ~/checksetup_answers.txt
perl scripts/update_params.pl urlbase "https://$C9_HOSTNAME/"
perl scripts/generate_bmo_data.pl
$SUDO service apache2 restart

$SUDO tee /etc/apache2/sites-enabled/001-cloud9.conf > /dev/null  <<'CODE'
PerlSwitches -wT
PerlConfigRequire /home/ubuntu/workspace/mod_perl.pl

<VirtualHost *:8080>
    DocumentRoot /home/ubuntu/workspace
    ServerName https://${C9_HOSTNAME}:443
    KeepAlive off

    LogLevel info

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /home/ubuntu/workspace>
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

ServerName https://${C9_HOSTNAME}
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
CODE