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

Commit 05a49f8

Browse files
committed
Using only docker for installation (no chroot anymore).
1 parent 12aabcd commit 05a49f8

27 files changed

+158
-451
lines changed

Dockerfile

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
### This file can be used to build a docker image like this:
22
### `docker build --tag=btr_client .`
3-
### It can also be used for automated builds in Docker Hub
4-
### (see https://docs.docker.com/userguide/dockerrepos/#automated-builds)
53

6-
FROM ubuntu:14.04
4+
FROM ubuntu-upstart:14.04
75

8-
### Install packages first, in order to take advantage
9-
### of caching features of `docker build`.
10-
COPY install/scripts/packages-and-software.sh /tmp/
11-
RUN DEBIAN_FRONTEND=noninteractive /tmp/packages-and-software.sh
6+
### Install packages.
7+
COPY install/packages.sh /tmp/
8+
RUN DEBIAN_FRONTEND=noninteractive /tmp/packages.sh
129

13-
### Copy the source code and run the installer.
10+
### Copy the source code and install.
1411
COPY . /usr/local/src/btr_client/
1512
ENV code_dir /usr/local/src/btr_client
1613
WORKDIR /usr/local/src/btr_client/
17-
RUN ["install/install-container.sh", "install/settings.sh"]
18-
19-
### Set the default command to run in the container.
20-
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf", "--nodaemon"]
21-
14+
RUN ["install/install.sh"]

dev/clone.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ chown www-data: -R $dst_dir/sites/default/files/*
9393
chown root: $dst_dir/sites/default/files/.htaccess
9494

9595
### restart services
96-
for service in php5-fpm memcached mysql nginx apache2
97-
do
98-
if test -f /etc/supervisor/conf.d/$service.conf
99-
then
100-
supervisorctl restart $service
101-
fi
102-
done
96+
/etc/init.d/mysql restart
97+
/etc/init.d/apache2 restart
98+
#/etc/init.d/php5-fpm restart
99+
#/etc/init.d/memcached restart
100+
#/etc/init.d/nginx restart

dev/clone_rm.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ sed -i /etc/hosts -e "/^127.0.0.1 $hostname/d"
3737
sed -i /etc/hosts.conf -e "/^127.0.0.1 $hostname/d"
3838

3939
### restart services
40-
#for service in php5-fpm memcached mysql nginx
41-
for service in php5-fpm memcached mysql nginx apache2
42-
do
43-
if test -f /etc/supervisor/conf.d/$service.conf
44-
then
45-
supervisorctl restart $service
46-
fi
47-
done
40+
/etc/init.d/mysql restart
41+
/etc/init.d/apache2 restart
42+
#/etc/init.d/php5-fpm restart
43+
#/etc/init.d/memcached restart
44+
#/etc/init.d/nginx restart

dev/install-sshd.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ mkdir -p /var/run/sshd/
99
### change the port
1010
port=${1:-2201}
1111
sed -i /etc/ssh/sshd_config -e "/^Port/c Port $port"
12-
13-
### enable and start the service
14-
mv /etc/supervisor/conf.d/sshd.conf{.disabled,}
15-
supervisorctl reload
16-
supervisorctl start sshd
12+
/etc/init.d/ssh restart
1713

1814
### generate public/private keys
1915
mkdir ~/.ssh

dev/reinstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ cd $code_dir/install/scripts/
2929
$code_dir/install/config.sh
3030

3131
### restart mysql
32-
supervisorctl restart mysql
32+
/etc/init.d/mysql restart

dev/webserver.sh

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
case $1 in
55
apache2 )
6-
supervisorctl stop nginx
7-
supervisorctl stop php5-fpm
6+
/etc/init.d/nginx stop
7+
/etc/init.d/php5-fpm stop
88

99
drush @local_bcl -y dis memcache
10-
supervisorctl stop memcached
10+
/etc/init.d/memcached stop
1111
for file in $(ls /var/www/bcl*/sites/default/settings.php)
1212
do
1313
sed -i $file -e "/comment memcache config/ d"
@@ -16,33 +16,31 @@ case $1 in
1616
-e "/'memcache_key_prefix'/a comment memcache config */"
1717
done
1818

19-
mv /etc/supervisor/conf.d/nginx.conf{,.disabled}
20-
mv /etc/supervisor/conf.d/php5-fpm.conf{,.disabled}
21-
mv /etc/supervisor/conf.d/memcached.conf{,.disabled}
22-
mv /etc/supervisor/conf.d/apache2.conf{.disabled,}
23-
supervisorctl reload
19+
update-rc.d nginx disable
20+
update-rc.d php5-fpm disable
21+
update-rc.d memcached disable
2422

25-
supervisorctl start apache2
23+
update-rc.d apache2 enable
24+
/etc/init.d/apache2 start
2625
;;
2726

2827
nginx )
29-
supervisorctl stop apache2
28+
/etc/init.d/apache2 stop
3029

31-
mv /etc/supervisor/conf.d/apache2.conf{,.disabled}
32-
mv /etc/supervisor/conf.d/nginx.conf{.disabled,}
33-
mv /etc/supervisor/conf.d/php5-fpm.conf{.disabled,}
34-
mv /etc/supervisor/conf.d/memcached.conf{.disabled,}
35-
supervisorctl reload
30+
update-rc.d apache2 disable
31+
update-rc.d nginx enable
32+
update-rc.d php5-fpm enable
33+
update-rc.d memcached enable
3634

3735
for file in $(ls /var/www/bcl*/sites/default/settings.php)
3836
do
3937
sed -i $file -e "/comment memcache config/ d"
4038
done
41-
supervisorctl start memcached
39+
/etc/init.d/memcached start
4240
drush @local_bcl -y en memcache
4341

44-
supervisorctl start php5-fpm
45-
supervisorctl start nginx
42+
/etc/init.d/php5-fpm start
43+
/etc/init.d/nginx start
4644
;;
4745
*)
4846
echo " * Usage: $0 {apache2 | nginx}"

docker-build.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash -x
2+
### Build a docker image.
3+
4+
function usage {
5+
echo "
6+
Usage: $0 [<settings> options]
7+
Install the project inside a container.
8+
9+
<settings> file of installation/configuration settings
10+
--git_branch=G git branch that will be installed
11+
--opt_name=V override any settings in the previous config files
12+
13+
Examples:
14+
$0 --git_branch=test
15+
$0 settings.sh --domain=example1.org --admin_passwd=xyz
16+
$0 gmail_settings.sh passwords.sh
17+
"
18+
exit 0
19+
}
20+
21+
### Get the project directory.
22+
project_dir=$(dirname $0)
23+
24+
### collect in a file all the settings and options
25+
options=$project_dir/options.sh
26+
cat <<EOF > $options
27+
#!/bin/bash
28+
### This file contains all the settings
29+
### and options given from the command line.
30+
31+
EOF
32+
33+
### save the default settings
34+
echo "### Start: $project_dir/install/settings.sh" >> $options
35+
cat $project_dir/install/settings.sh >> $options
36+
echo "### End: $project_dir/install/settings" >> $options
37+
38+
### get command line options and save them to options.sh
39+
for opt in "$@"
40+
do
41+
case $opt in
42+
--git_branch=*) git_branch=${opt#*=} ;;
43+
-h|--help) usage ;;
44+
--*=*)
45+
optvalue=${opt#*=}
46+
optname=${opt%%=*}
47+
optname=${optname:2}
48+
echo $optname="$optvalue" >> $options
49+
;;
50+
*)
51+
if [ ${opt:0:1} = '-' ]; then usage; fi
52+
53+
settings=$opt
54+
if ! test -f "$settings"
55+
then
56+
echo "File '$settings' does not exist."
57+
exit 1
58+
fi
59+
echo "### Start: $settings" >> $options
60+
cat $settings >> $options
61+
echo "### End: $settings" >> $options
62+
;;
63+
esac
64+
done
65+
66+
### make sure that we are using the right git branch
67+
git_branch=${git_branch:-master}
68+
current_dir=$(pwd)
69+
cd $project_dir/
70+
git checkout $git_branch
71+
git pull
72+
cd $current_dir
73+
74+
### start building and logging
75+
project=$(basename $(ls $project_dir/*.info | sed -e 's/\.info$//'))
76+
nohup_out=nohup-$project-$git_branch.out
77+
rm -f $nohup_out
78+
nohup nice docker build --tag=$project:$git_branch $project_dir/ > $nohup_out &
79+
sleep 1
80+
tail -f $nohup_out

install/chroot.sh

Lines changed: 0 additions & 114 deletions
This file was deleted.

install/config/gmailsmtp.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ if [ -z "${gmail_account+xxx}" -o "$gmail_account" = '' ]
1212
then
1313
gmail_account='[email protected]'
1414
read -p "Enter the gmail address [$gmail_account]: " input
15-
gmail_account=${input:-$gmail_account}
15+
gmail_account=$input
16+
fi
17+
18+
if [ "$gmail_account" = '' ]
19+
then
20+
echo "Skipping configuration of gmail account."
21+
echo -e "You can do it later by calling:\n $0"
22+
exit 0
1623
fi
1724

1825
if [ -z "${gmail_passwd+xxx}" -o "$gmail_passwd" = '' ]
@@ -45,6 +52,3 @@ echo "Modifying drupal variables that are used for sending email..."
4552
$(dirname $0)/mysqld.sh start
4653
drush --yes @local_bcl php-script $(dirname $0)/gmailsmtp.php \
4754
"$gmail_account" "$gmail_passwd"
48-
49-
### drush may create css/js files with wrong(root) permissions
50-
chown www-data: -R /var/www/bcl*/sites/default/files/{css,js}

0 commit comments

Comments
 (0)