Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Commit 4dbbf10

Browse files
authored
Upgrade from Ubuntu 14.04 (Trusty) to Ubuntu 16.04 (Xenial) (#601)
### Upgrade from Ubuntu 14.04 (Trusty) to Ubuntu 16.04 (Xenial) * **NOTE**: These changes require `Xenial` to be used from this point forward. `Trusty` will no longer work as there are _various incompatibilities_. * The platform is now exclusively supported on Ubuntu 16.04 (Xenial). Trusty (14.04) is no longer supported after this commit. * HHVM has been upgraded to to version 3.21. * Provision, Docker, and Vagrant configurations have been updated to support 16.04. This includes Travis builds which utilizes the Docker image (PR #569). * Provision Changes: * HHVM repo and repo keys updated for Xenial * HHVM "restarted" instead of "started" after HHVM repo mode enabled. Enabling repo mode appears to start HHVM before permissions are applied to repo file. Therefore it must be restarted. * `osquery` repo source updated for Xenial * `node.js` legacy purge removed before installation, as this is not required for Xenial * Package `language-pack-en` removed, this is installed and no longer required. * Package `php5-cli` replaced with `php7.0-cli` for compatibility with Xenial. * MySQL configuration file changed from `/etc/mysql/my.cnf` to `/etc/mysql/mysql.conf.d/mysqld.cnf` for compatibility with Xenial. * Vagrant Changes: * Base VM changed to Xenial * Docker Changes: * Images for standalone and multi-setup changed to Xenial * Web directory permissions set to `www-data`. Otherwise, the web directory will be owned by root and cause permissions issues. * MySQL permissions enforced on `/var/lib/mysql and /var/run/mysql`. Otherwise, these directories will be owned by root and MySQL will not function. * HHVM explicitly started as `www-data`. Docker does not allow HHVM startup (running under root) to spawn an HHVM process under another user (www-data). * `sudo` and `apt-utils` installed. These are required packages for provision. * Based on recommended HHVM DockerFile, `ENV HHVM_DISABLE_NUMA` parameter added and set to true.
1 parent d2659ff commit 4dbbf10

17 files changed

+55
-35
lines changed

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM ubuntu:trusty
2-
LABEL maintainer="Boik Su <[email protected]>"
1+
FROM ubuntu:xenial
32

43
ENV HOME /root
54

@@ -10,9 +9,11 @@ ARG TYPE=self
109
ARG KEY
1110
ARG CRT
1211

12+
ENV HHVM_DISABLE_NUMA true
13+
1314
WORKDIR $HOME
1415
COPY . $HOME
15-
RUN chown www-data:www-data $HOME
1616

17+
RUN apt-get update && apt-get -y install sudo apt-utils
1718
RUN ./extra/provision.sh -m $MODE -c $TYPE -k $KEY -C $CRT -D $DOMAIN -e $EMAIL -s `pwd` --docker
1819
CMD ["./extra/service_startup.sh"]

Vagrantfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
VAGRANTFILE_API_VERSION = "2"
55

66
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7-
config.vm.box = "ubuntu/trusty64"
7+
config.vm.box = "ubuntu/xenial64"
88
config.vm.network "private_network", ip: "10.10.10.5"
99
config.vm.hostname = "FacebookCTF-Dev"
1010
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

Vagrantfile-multi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
VAGRANTFILE_API_VERSION = "2"
55

66
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7-
config.vm.box = "ubuntu/trusty64"
7+
config.vm.box = "ubuntu/xenial64"
88
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
99

1010
# MySQL Server

Vagrantfile-single

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
VAGRANTFILE_API_VERSION = "2"
55

66
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7-
config.vm.box = "ubuntu/trusty64"
7+
config.vm.box = "ubuntu/xenial64"
88
config.vm.network "private_network", ip: "10.10.10.5"
99
config.vm.hostname = "facebookCTF-Dev"
1010
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"

extra/cache/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM ubuntu:trusty
2-
LABEL maintainer="Boik Su <[email protected]>"
1+
FROM ubuntu:xenial
32

43
ENV HOME /root
54

@@ -13,5 +12,6 @@ ARG CRT
1312
WORKDIR $HOME
1413
COPY . $HOME
1514

15+
RUN apt-get update && apt-get -y install sudo apt-utils
1616
RUN ./extra/provision.sh -m $MODE -c $TYPE -k $KEY -C $CRT -D $DOMAIN -e $EMAIL -s `pwd` --docker --multiple-servers --server-type cache
1717
CMD ["./extra/cache/cache_startup.sh"]

extra/hhvm/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM ubuntu:trusty
2-
LABEL maintainer="Boik Su <[email protected]>"
1+
FROM ubuntu:xenial
32

43
ENV HOME /root
54

@@ -10,8 +9,11 @@ ARG TYPE=self
109
ARG KEY
1110
ARG CRT
1211

12+
ENV HHVM_DISABLE_NUMA true
13+
1314
WORKDIR $HOME
1415
COPY . $HOME
1516

17+
RUN apt-get update && apt-get -y install sudo apt-utils
1618
RUN ./extra/provision.sh -m $MODE -c $TYPE -k $KEY -C $CRT -D $DOMAIN -e $EMAIL -s `pwd` --docker --multiple-servers --server-type hhvm --mysql-server mysql --cache-server cache
1719
CMD ["./extra/hhvm/hhvm_startup.sh"]

extra/hhvm/hhvm_startup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set -e
44

5-
service hhvm restart
5+
chown -R www-data:www-data /var/www/fbctf
6+
sudo -u www-data service hhvm restart
67

78
while true; do
89
if [[ -e /var/run/hhvm/sock ]]; then

extra/lib.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function install_unison() {
5959
function repo_osquery() {
6060
log "Adding osquery repository keys"
6161
sudo DEBIAN_FRONTEND=noninteractive apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1484120AC4E9F8A1A577AEEE97A80C63C9D8B80B
62-
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository "deb [arch=amd64] https://osquery-packages.s3.amazonaws.com/trusty trusty main"
62+
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository "deb [arch=amd64] https://pkg.osquery.io/deb deb main"
6363
}
6464

6565
function install_mysql() {
@@ -229,16 +229,14 @@ function install_hhvm() {
229229

230230
package software-properties-common
231231

232-
log "Adding HHVM key"
232+
log "Adding HHVM keys"
233233
sudo DEBIAN_FRONTEND=noninteractive apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
234+
sudo DEBIAN_FRONTEND=noninteractive apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94
234235

235236
log "Adding HHVM repo"
236-
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
237+
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository "deb http://dl.hhvm.com/ubuntu xenial-lts-3.21 main"
237238

238239
package_repo_update
239-
240-
log "Installing HHVM"
241-
# Installing the package so the dependencies are installed too
242240
package hhvm
243241

244242
log "Enabling HHVM to start by default"
@@ -274,7 +272,7 @@ function hhvm_performance() {
274272
cat "$__config" | sed "s|$__oldrepo|$__repofile|g" | sudo tee "$__config"
275273
sudo hhvm-repo-mode enable "$__path"
276274
sudo chown www-data:www-data "$__repofile"
277-
sudo service hhvm start
275+
sudo service hhvm restart
278276
}
279277

280278
function install_composer() {
@@ -288,9 +286,6 @@ function install_composer() {
288286
}
289287

290288
function install_nodejs() {
291-
log "Removing node.js legacy version"
292-
sudo DEBIAN_FRONTEND=noninteractive apt-get remove --purge nodejs -y
293-
294289
log "Downloading and setting node.js version 6.x repo information"
295290
dl_pipe "https://deb.nodesource.com/setup_6.x" | sudo -E bash -
296291

extra/mysql/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
FROM ubuntu:trusty
2-
LABEL maintainer="Boik Su <[email protected]>"
1+
FROM ubuntu:xenial
32

43
ENV HOME /root
54

@@ -13,5 +12,6 @@ ARG CRT
1312
WORKDIR $HOME
1413
COPY . $HOME
1514

15+
RUN apt-get update && apt-get -y install sudo apt-utils
1616
RUN ./extra/provision.sh -m $MODE -c $TYPE -k $KEY -C $CRT -D $DOMAIN -e $EMAIL -s `pwd` --docker --multiple-servers --server-type mysql
1717
CMD ["./extra/mysql/mysql_startup.sh"]

extra/mysql/mysql_startup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
set -e
44

5+
chown -R mysql:mysql /var/lib/mysql
6+
chown -R mysql:mysql /var/run/mysqld
7+
chown -R mysql:mysql /var/log/mysql
8+
59
service mysql restart
610

711
while true; do

0 commit comments

Comments
 (0)