Skip to content

Commit

Permalink
Merge pull request #183 from gwarf/ansible_updates
Browse files Browse the repository at this point in the history
Ansible updates and documetation improvements
  • Loading branch information
kouril authored Nov 4, 2022
2 parents 101a82b + e3e41cf commit 887d448
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 24 deletions.
14 changes: 7 additions & 7 deletions install/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

This is [Ansible](https://www.ansible.com/) script for automatic deployment of Pakiti server.

## Prerequisities
## Prerequisites

This script does not install Pakiti prerequisities, therefore you need to install following prerequisities manually:
This script does not install Pakiti prerequisites, therefore you need to install following prerequisities manually:

* MySQL Database Server
* Apache2 Web Server
* PHP5 + PHP5 MySQL module
* curl + PHP5 curl module
* PHP (at least 5) + PHP MySQL module
* curl + PHP curl module
* Subversion

Furthermore you need to have Ansible installed. It is recommended to have latest Ansible version installed which may not be available from your distro's repositories. To find out how to install latest Ansible version on your system please review [official documentation page](https://docs.ansible.com/ansible/latest/intro_installation.html).
Expand All @@ -23,7 +23,7 @@ Also for Ansible installation you need to have following extra packages present

## Installation using Ansible

This ansible playbook is written so that it is expected you will launch the installation directly from the server where you want to install Pakiti. Therefore you have to first move this folder on the host where you want to install pakiti server.
You first need to create an [ansible inventory](https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html) file, like `inventory.cfg`.

Next you have to change the configuration of the installation. To do this, please modify values in `ansible-conf.yml` file present in this folder. The variables you will want to change and their meaning is following:

Expand All @@ -37,8 +37,8 @@ Next you have to change the configuration of the installation. To do this, pleas

Finally when you have changed the defaults in config file, you may launch the installation by executing command

```
ansible-playbook playbook.yml
```shell
ansible-playbook -i inventory.cfg playbook.yml
```

## Post installation steps
Expand Down
4 changes: 3 additions & 1 deletion install/ansible/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
- hosts: localhost
---
- name: Install Pakiti, dropping existing database content
hosts: all
vars_files:
- ansible-conf.yml
roles:
Expand Down
4 changes: 4 additions & 0 deletions install/ansible/roles/pakiti-server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ mysql_root_name: root
mysql_root_password: root_mysql_passwd
pakiti_domain_name: pakiti.com
pakiti_admin_mail: [email protected]
pakiti_git_version: master
pakiti_webserver_user: root
pakiti_webserver_conf_template: "etc/apache2/pakiti.conf.j2"
pakiti_config_template = "etc/pakiti/Config.php.j2"
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---

- name: Make Pakiti configuration available in Apache
template:
src: etc/apache2/pakiti.conf.j2
src: "{{ pakiti_webserver_conf_template }}"
dest: /etc/apache2/conf-available/pakiti.conf
owner: root
mode: 0644

- name: Activate Pakiti in Apache
command: "a2enconf pakiti"

12 changes: 7 additions & 5 deletions install/ansible/roles/pakiti-server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
when: ansible_facts['distribution'] == 'Debian'

- name: Download repository from github and place it to /var/www
shell: git clone https://github.com/CESNET/pakiti-server /var/www/pakiti-server
args:
executable: /bin/bash
ansible.builtin.git:
repo: "https://github.com/CESNET/pakiti-server"
dest: /var/www/pakiti-server
version: "{{ pakiti_git_version }}"

- name: Create /etc/pakiti directory
file:
Expand All @@ -29,10 +30,11 @@

- name: Populate Pakiti configuration
template:
src: etc/pakiti/Config.php.j2
src: "{{ pakiti_config_template }}"
dest: /etc/pakiti/Config.php
owner: root
mode: 0600
group: "{{ pakiti_webserver_user }}"
mode: 0640

- name: Initalize Pakiti database and create the application user
shell: "php /var/www/pakiti-server/install/initDB.php --reInitialize --user-name={{ mysql_root_name }} --password={{ mysql_root_password }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---

- name: Enable Pakiti in Apache
template:
src: etc/apache2/pakiti.conf.j2
src: "{{ pakiti_webserver_conf_template }}"
dest: /etc/httpd/conf.d/pakiti.conf

- name: Restart Apache to load new configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ Alias /pakiti/feed/ /var/www/pakiti-server/src/modules/feeder/www/
</Location>

Alias /pakiti/protected/ /var/www/pakiti-server/src/modules/gui/www/
<Location /protected>
<Location /pakiti/protected>
# TODO add authentication here !
DirectoryIndex hosts.php
Require all granted
</Location>

Alias /pakiti/ /var/www/pakiti-server/src/modules/gui/www/public/
<Location /pakiti/feed>
<Location /pakiti>
DirectoryIndex index.php
Require all granted
</Location>

Alias /pakiti/api/ /var/www/pakiti3/src/modules/api/
<Location /api>
Alias /pakiti/api/ /var/www/pakiti-server/src/modules/api/
<Location /pakiti/api>
Require ip 127.0.0.1
</Location>
4 changes: 2 additions & 2 deletions install/server-bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/php
<?php

require(realpath(dirname(__FILE__)) . '/../../common/Loader.php');
require(realpath(dirname(__FILE__)) . '/../vds/VdsModule.php');
require(realpath(dirname(__FILE__)) . '/../src/common/Loader.php');
require(realpath(dirname(__FILE__)) . '/../src/modules/vds/VdsModule.php');

$vds_defs = [
/* "defName" => [ "subSource", "defURI" ] */
Expand Down

0 comments on commit 887d448

Please sign in to comment.