- Git
- Docker
- Docker-Compose
- Server with Apache2 or Nginx. The server needs to have at least a public IP address
Before starting:
Either add your user to the docker group on the system or run every next docker command in the README as sudo. To add your user to the docker group run sudo usermod -aG docker $USER
.
-
Clone this repository to your webserver:
git clone https://github.com/username/CultURIze-Back-End-Docker
-
And enter the directory of the cloned repository:
cd CultURIze-Back-End-Docker
Depending on what webserver you are running on your docker host, choose the right configuration. In CultURIze always choose apache as this is used interanally in the docker container.
-
Remove or rename the default configuration file for Nginx
(/etc/nginx/sites-enables/default.conf)
if doing this set-up for the first time.sudo rm /etc/nginx/sites-enabled/default.conf
orsudo mv /etc/nginx/sites-enabled/default.conf /etc/nginx/sites-enabled/default.conf.bak
-
place the configuration file found in this repository (/CultURIze-Back-End-Docker/docs/nginx-conf/) in
/etc/nginx/sites-available/
directory on your webserver.sudo mv /home/user/CultURIze-Back-End-Docker/docs/nginx-conf/culturize.conf /etc/nginx/sites-available/
-
Create symbolic link from /etc/nginx/sites-available to /etc/nginx/sites-enabled/ like so:
cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/culturize.conf .
-
Run the
docker-compose build
command from inside the cloned repository to create the docker containers. -
Start the docker containers with
docker-compose up -d
-
Remove or rename the default configuration file for Apache2
(/etc/apache2/sites-enables/000-default.conf)
sudo rm /apache2/sites-enabled/000-default.conf
orsudo mv /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/000-default.conf.bak
-
place the configuration file found in this repository (/CultURIze-Back-End-Docker/docs/apache2-conf/) in
/etc/apache2/sites-available/
directory on your webserver.sudo mv /home/user/CultURIze-Back-End-Docker/docs/apache2-conf/culturize.conf /etc/apache2/sites-available/
-
Create symbolic link from /etc/apache2/sites-available to /etc/apache2/sites-enabled/
cd /etc/apache2/sites-enabled
sudo ln -s ../sites-available/culturize.conf .
-
Run the
docker-compose build
command from inside the cloned repository to create the docker containers. -
Start the docker containers with
docker-compose up -d
-
enable http_proxy mod and restart your webserver by typing following commands in your terminal More information
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo systemctl restart apache2.service
Our next step is to add our newly created webhook http://SERVER_IP/github/
to github.
To achieve this, go to your github project, in the project menu navigate to settings.
Then in the your settings menu, situated on the left of the screen, select webhooks
then 'add a webhook'. On this page you can fill in:
- payload url : with your newly created webhook url
http://SERVER_IP/github/
- content-type : can be set to
application/json
- secret : may be left empty
- Which events would you like to trigger this webhook? : set this to 'just push events'
- Finaly make sur that the active checkbox is checked.
Once this is saved each time you will push to your repository a POST method will be issued to your webhook with informations regarding the push event. Uppon saving the webhook GitHub will trigger a ping packet to the webhook, you should see a green checkmark with statu 200 OK on this ping. If you don't see this there is something wrong in the setup. You can resend this test ping packet from the Github webhook webpage.
To check if it works you can push a change to your repository and you should notice on the server in your repository the folder apache-htaccess getting filled with the htaccess-files.
You're all set now! Everytime you'll upload PIDs to the repository for which you congured the webhook, it will automatically be published at http://your-server-IP/$subdirectory/$PID, e.g. http://example.org/rembrand/work/1 Remember that you always need to select Apache in the CultURIze tool with this docker setup as apache is used in the docker containers.
- Run the command
docker-compose stop
inside the repository folder of the culturize docker - Run the command
docker-compose rm
inside the repository folder - Run the command
docker-compose rmi
inside the repository folder