Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ca60916
Updated Dockerfile to RC6
ywarnier Oct 14, 2015
d31a05b
Testing 1.10.x container
ywarnier Feb 17, 2016
b5fa7fd
Update Dockerfile to new Chamilo setup procedure
ywarnier Feb 18, 2016
f8d2bcc
Update Dockerfile to use pre-built vendors repo for Chamilo
ywarnier Feb 18, 2016
615fcb5
Updates to Dockerfile to use proxy repositories and avoid composer
ywarnier Feb 18, 2016
c5bb7e4
Update Dockerfile for new 1.11.x branch
ywarnier Aug 16, 2016
89eec3a
Change priority of composer update
ywarnier Aug 16, 2016
d45fa56
ignore local bash script samples
diego-bendlin Sep 9, 2020
1e4caec
Chamilo.conf merged version between github's docker-chamilo -1.11.x a…
diego-bendlin Sep 9, 2020
51b4ad1
Docs updated, made some changes to avoid people folowwing step by ste…
diego-bendlin Sep 9, 2020
561022a
Updated base iga to ubuntu 20.04, apt install also updates dependenci…
diego-bendlin Sep 9, 2020
1fec724
forgotten .htaccess added :)
diego-bendlin Sep 9, 2020
7bdb248
Found a OCI layer 8 problem ( @me =/) we dont need to add .htacess, j…
diego-bendlin Sep 9, 2020
c794dcb
Unified to original doc MYSQL_ROOT_PASSWORD
diego-bendlin Sep 9, 2020
3ea1862
Added composer from ubuntu repo, could not find chash install cantida…
diego-bendlin Sep 9, 2020
93fb59f
Found that when getting chamilo from github, composer update -n must …
diego-bendlin Sep 9, 2020
3f4c3d7
Docs updated to remommend doing customizations in the build phase, I …
diego-bendlin Sep 9, 2020
20705e6
php-fpm added, ENV variable substitutions command deleted, images are…
diego-bendlin Sep 13, 2020
13d7be4
copying chamilo.conf to chamilo.conf instead of chamilo.conf.ori
diego-bendlin Sep 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh
102 changes: 51 additions & 51 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
FROM ubuntu:14.04
MAINTAINER Yannick Warnier <ywarnier@chamilo.org>
FROM ubuntu:20.04
LABEL author="Yannick Warnier <ywarnier@chamilo.org>"
LABEL contributor="Diego Bendlin <diego.bendlin@gmail.com>"

ARG MYSQL_ROOT_PASSWORD
ARG FQDN
ARG TZ
ARG APACHE_LOG_DIR
# Environment section
ENV FQDN ${FQDN}
ENV TZ ${TZ}
ENV APACHE_LOG_DIR ${APACHE_LOG_DIR}

# Configure Timezone
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone

# Keep upstart from complaining
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -sf /bin/true /sbin/initctl

# Update Ubuntu and install basic PHP stuff
RUN apt-get -y update && apt-get install -y \
curl \
git \
libapache2-mod-php5 \
php5-cli \
php5-curl \
php5-gd \
php5-intl \
php5-mysql \
wget

RUN apt-get install -y openssh-server
RUN mkdir -p /var/run/sshd

# Get Chamilo
RUN mkdir -p /var/www/chamilo
ADD https://github.com/chamilo/chamilo-lms/archive/v1.10.0-alpha.tar.gz /var/www/chamilo/chamilo.tar.gz
WORKDIR /var/www/chamilo
RUN tar zxf chamilo.tar.gz;rm chamilo.tar.gz;mv chamilo* www
WORKDIR www
RUN chown -R www-data:www-data \
app \
main/default_course_document/images \
main/lang \
vendor \
web

# Get Composer (putting the download in /root is discutible)
WORKDIR /root
RUN curl -sS https://getcomposer.org/installer | php
RUN chmod +x composer.phar
RUN mv composer.phar /usr/local/bin/composer

# Get Chash
RUN git clone https://github.com/chamilo/chash.git chash
WORKDIR chash
RUN composer update --no-dev
RUN php -d phar.readonly=0 createPhar.php
RUN chmod +x chash.phar && mv chash.phar /usr/local/bin/chash
# Update Ubuntu and install all required packages
RUN apt-get -y update && apt-get install -y apt-utils
RUN apt-get install -y apache2 mysql-client php \
libapache2-mod-php php-mysqlnd php-mysql \
php-xml php-json php-iconv php-gd php-intl php-mbstring \
php-ctype php-ldap php-curl php-xsl php-zip php-fpm \
git composer curl nano unzip debconf-utils gettext-base iputils-ping net-tools

# Configure MySQL
RUN echo "mysql-server mysql-server/root_password password ${MYSQL_ROOT_PASSWORD}" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password ${MYSQL_ROOT_PASSWORD}" | debconf-set-selections

# Add datetime setting to php.ini
RUN echo "date.timezone = ${TZ}" >> /etc/php/7.4/apache2/php.ini
RUN echo "date.timezone = ${TZ}" >> /etc/php/7.4/cli/php.ini

# Get Chamilo from Github
WORKDIR /var/www
RUN git clone --depth=1 --single-branch -b 1.11.x https://github.com/chamilo/chamilo-lms.git

# Go to Chamilo folder and update composer resources
WORKDIR /var/www/chamilo-lms
# Change permissions
RUN mkdir -p vendor && mkdir -p web
RUN chown -R www-data:www-data app main/default_course_document/images main/lang vendor web
RUN chmod 0775 -R app main/default_course_document/images main/lang web && chmod 0555 -R vendor
RUN composer update -n

# Configure and start Apache
ADD chamilo.conf /etc/apache2/sites-available/chamilo.conf
RUN a2ensite chamilo
RUN echo "ServerName ${FQDN}" >> /etc/apache2/apache2.conf
RUN echo "127.0.0.1 ${FQDN}" >> /etc/hosts
## Enable Rewrite module
RUN a2enmod rewrite
RUN /etc/init.d/apache2 restart
RUN echo "127.0.0.1 docker.chamilo.net" >> /etc/hosts
#RUN a2enmod rewrite headers expires ssl

# Go to Chamilo folder and install
# Soon... (this involves having a SQL server in a linked container)
## Enable Chamilo Site
ADD chamilo.conf /etc/apache2/sites-available/chamilo.conf
RUN a2ensite chamilo

WORKDIR /var/www/chamilo/www
EXPOSE 22 80
CMD ["/bin/bash"]
EXPOSE 80/tcp
ENTRYPOINT [ "/usr/sbin/apache2ctl", "-D", "FOREGROUND" ]
138 changes: 114 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,170 @@
# docker-chamilo

Official Docker image for Chamilo LMS

This image is not ready yet. Please come back soon or watch the project for updates.

## Build docker image

This process will download chamilo-lms and other components from github and build an image on your cocker host machine.

Some values can be passed as --build-arg and later as environment variables.

```bash
docker build -t chamilo/docker-chamilo:1.11.12 \
--build-arg MYSQL_ROOT_PASSWORD="pass" \
--build-arg FQDN="chamilo.example.net" \
--build-arg TZ="Europe/Brussels" \
--build-arg APACHE_LOG_DIR="/var/log/apache2" \
.
```

## Launching

This image is currently based on Chamilo LMS 1.10 and requires a separate database container to run.
We suggest using the "mariadb" container, like so:

```bash
docker run -d \
--name chamilo-db \
--hostname chamilo-db \
--domainname example.net \
-e MYSQL_ROOT_PASSWORD=pass \
-e MYSQL_USER=chamilo \
-e MYSQL_PASSWORD=chamilo \
-e MYSQL_DATABASE=chamilo \
mariadb
```
docker run --name mariadb -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_USER=chamilo -e MYSQL_PASSWORD=chamilo -e MYSQL_DATABASE=chamilo -d mariadb

This will get you back on the command line of the Docker host. You can see the container running with:

```bash
docker ps
```

This will get you back on the command line of the Docker host. You can see the container running with ```docker ps```.
Then start the chamilo/docker-chamilo container:

Then start the chamilo/docker-chamilo container:
Please note that you'll hace to customize settings before building the image, work still have to be done to hace ENV variables override all resources when docker run gets exetuted.

```
docker run --link=mariadb:db --name chamilo -p 8080:80 -it chamilo/docker-chamilo
```bash
docker run -d \
--name chamilo \
--hostname chamilo \
--domainname example.net \
--link=chamilo-db \
-p 80 \
chamilo/docker-chamilo:1.11.12
```

At this point, the docker-chamilo image doesn't provide an installed version of Chamilo LMS, but this should be ready soon.

The configuration files assume the host will be "docker.chamilo.net", so you will have to define it in your host's /etc/hosts file, depending on the IP of the container.
The configuration files assume the host will be "chamilo.example.net", so you will have to define it in your host's /etc/hosts file, depending on the IP of the container.

```
72.17.0.10 docker.chamilo.net
```bash
72.17.0.10 chamilo.example.net
```

Now start your browser and load http://docker.chamilo.net.
Now start your browser and load <http://chamilo.example.net>

## Using with a load-balancer

If you want to use a more complex system with load balancing, you might want to try out the following suite of commands:

```bash
docker run -d \
--name=varwww \
ywarnier/varw
```
docker run --name varwww -d ywarnier/varw
```

This will provide a shared /var/www2 partition
This will provide a shared /var/www2 partition.

To avoid conflicts with the containers created above we will start a new database container

```bash
docker run -d \
--name=chamilo-db_lb \
--hostname=chamilo-db_lb \
--domainname=example.net \
-e MYSQL_ROOT_PASSWORD=pass \
-e MYSQL_USER=chamilo \
-e MYSQL_PASSWORD=chamilo \
-e MYSQL_DATABASE=chamilo \
mariadb
```

```bash
docker run -d \
--name=chamilo_lb-n1 \
--hostname=chamilo_lb-n1 \
--domainname=example.net \
--link=chamilo-db_lb \
--volumes-from=varwww \
-p 80 \
chamilo/docker-chamilo:1.11.12
```
docker run --name mariadb -e MYSQL_ROOT_PASSWORD=pass -e MYSQL_USER=chamilo -e MYSQL_PASSWORD=chamilo -e MYSQL_DATABASE=chamilo -d mariadb
docker run --link=mariadb:db --volumes-from=varwww --name chamilo -p 8080:80 -it chamilo/docker-chamilo
# Change all configuration to point to /var/www2/chamilo/www and change the Chamilo config file (root_web)
# Also, inside app/config/configuration.php, change "session_stored_in_db" to true
# configure Chamilo on this first container then take a snapshot

### Some extra Configuration

Change all configuration to point to /var/www2/chamilo/www and change the Chamilo config file (root_web)
Also, inside app/config/configuration.php, change "session_stored_in_db" to true
configure Chamilo on this first container then take a snapshot

```bash
docker commit -m "Live running Chamilo connected to host 'db' with existing database" {container-hash} docker-chamilo:live
docker run --link=mariadb:db --volumes-from=varwww --name chamilo2 -p 8081:80 -it docker-chamilo:live
docker run --name lb --link=chamilo:w1 --link=chamilo4:w2 -e CHAMILO_1_PORT_80_TCP_ADDR=172.17.0.10 -e CHAMILO_2_PORT_80_TCP_ADDR=172.17.0.11 -e CHAMILO_HOSTNAME=docker.chamilo.net -e CHAMILO_PATH=/ -p 8082:80 -it jasonwyatt/nginx-loadbalancer
```

Sadly, there's something wrong at the moment in the nginx-loadbalancer image, and you have to connect to it to change the configuration of the reverse proxy (the last container you launched).
### Start another container

```bash
docker run -d \
--name=chamilo_lb-n2 \
--hostname=chamilo_lb-n2 \
--domainname=example.net \
--link=chamilo-db_lb \
--volumes-from=varwww \
-p 80 \
docker-chamilo:live
```

### Start the load-balancer

```bash
docker run -it \
--name lb \
--link=chamilo_lb-n1:w1 \
--link=chamilo_lb-n2:w2 \
-e CHAMILO_1_PORT_80_TCP_ADDR=172.17.0.10 \
-e CHAMILO_2_PORT_80_TCP_ADDR=172.17.0.11 \
-e CHAMILO_HOSTNAME=chamilo.example.net \
-e CHAMILO_PATH=/ \
-p 80 \
jasonwyatt/nginx-loadbalancer
```

Sadly, there's something wrong at the moment in the nginx-loadbalancer image, and you have to connect to it to change the configuration of the reverse proxy (the last container you launched).

```bash
docker ps
```

(to identify the hash of the image of the load balancer (lb))

```
docker exec -i -t {lb-container-hash} bash
```bash
docker exec -it {lb-container-hash} /bin/bash
cd /etc/nginx/sites-available/
vi proxy.conf
```

(add the following *just before* proxy_pass, in the two occurrences)

```
```bash
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
```

Now reload Nginx

```
```bash
service nginx reload
```

Expand Down
Loading