Changeset 0c882bec in darkpeak-services


Ignore:
Timestamp:
Jul 14, 2018, 9:39:48 AM (19 months ago)
Author:
Caolan McMahon <caolan.mcmahon@…>
Branches:
ansible, keycloak, master, matrix, pleroma
Children:
40a95da9, 93b7eb7d
Parents:
c9f3ebd0
Message:

Switch sabredav to mysql so we can copy over existing data

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • README.md

    rc9f3ebd0 r0c882bec  
    88    git submodule init
    99    git submodule update
     10   
     11## Install Ansible 2.4+
    1012
    11 ### Create Your Development Playbook
     13The geerlingguy playbooks for postgresql and mysql (in `roles/community`) use features like `include_tasks` which were introduced in Ansible 2.4. You should make sure your ansible version is >= 2.4.
     14
     15### Installing a newer ansible on Debian Stretch
     16
     17Add the following to `sources.list` (or add a new file with the
     18`.list` extension to `/etc/apt/sources.list.d/`):
     19
     20    deb http://ftp.uk.debian.org/debian stretch-backports main
     21
     22Then run:
     23
     24    sudo apt-get update
     25    sudo apt-get install -t stretch-backports ansible
     26
     27## Create Your Development Playbook
    1228
    1329Make a copy of the production playbook and edit it to include only those services on which you want to work:
     
    1834Then set the "development_mode" variable to "true" and the "domain_name" variable to something appropriate, like "darkpeak.dev" and you are ready to go.
    1935
    20 ### Developing With Vagrant
     36## Developing With Vagrant
    2137
    2238Run the playbook:
     
    2844    sudo usermod -aG libvirt $USER
    2945
    30 ### Developing Without Vagrant
     46## Developing Without Vagrant
    3147
    3248For those that are unable to use Virtual Box due to it requiring you to disable Secure Boot, and if you cannot use libvirt as a Vagrant back-end, you can run the playbook directly at a pre-existing VM, but it needs some preparation first.
     
    5975    ansible-playbook -i darkpeak.vm, dev-playbook.yml
    6076
    61 ### Testing
     77## Testing
    6278
    6379In order to test, you will need to add hostnames to your hosts file. The TLD has to match that which you used earlier when you edited your development playbook. If you set the domain name variable to "darkpeak.dev" and you are working on the wiki and irc bouncer, for example, then add the following to your /etc/hosts file substituting your VM's IP:
  • roles/community/geerlingguy.postgresql

    • Property commit changed from 2fbaa2d33e6dd8a333968de27a7422296cca3ade to 66e8af0adf8d0e56d55d14f3da99a5347f9f4334
  • roles/sabredav/defaults/main.yml

    rc9f3ebd0 r0c882bec  
    66php_open_basedir: "{{ web_root }}:/usr/share/php:/tmp"
    77
    8 postgresql_users:
     8mysql_databases:
     9  - name: "{{ service_name }}"
     10   
     11mysql_users:
    912  - name: "{{ service_name }}"
    1013    password: correcthorsebatterystaple
    11     role_attr_flags: CREATEDB,NOSUPERUSER
    12 
    13 postgresql_databases:
    14   - name: "{{ service_name }}"
    15     owner: "{{ postgresql_users[0].name }}"
    16     lc_collate: en_GB.UTF-8
    17     lc_ctype: en_GB.UTF-8
     14    priv: "{{ service_name }}.*:ALL"
    1815
    1916db:
    20   user: "{{ postgresql_users[0].name }}"
    21   password: "{{ postgresql_users[0].password }}"
    22   name: "{{ postgresql_databases[0].name }}"
     17  user: "{{ mysql_users[0].name }}"
     18  password: "{{ mysql_users[0].password }}"
     19  name: "{{ mysql_databases[0].name }}"
    2320  server: "localhost"
    2421
  • roles/sabredav/meta/main.yml

    rc9f3ebd0 r0c882bec  
    22  - role: locales
    33  - role: apache2
    4   - role: community/geerlingguy.postgresql
     4  - role: community/geerlingguy.mysql
  • roles/sabredav/tasks/main.yml

    rc9f3ebd0 r0c882bec  
    1313    createhome: no
    1414
    15 - name: Add postgresql user
    16   include: ../../community/geerlingguy.postgresql/tasks/users.yml
     15- name: Add mysql user
     16  include: ../../community/geerlingguy.mysql/tasks/users.yml
    1717
    18 - name: Add postgresql database
    19   include: ../../community/geerlingguy.postgresql/tasks/databases.yml
     18- name: Add mysql database
     19  include: ../../community/geerlingguy.mysql/tasks/databases.yml
    2020
    2121- name: Enable LDAP modules in apache
     
    4646    - php-dom
    4747    - php-mbstring
    48     - php-pgsql
     48    - php-mysql
    4949    - php-ldap
    5050
     
    8080
    8181- name: Initialise database
    82   become_user: "{{ service_name }}"
    83   shell: "for f in {{ web_root }}/vendor/sabre/dav/examples/sql/pgsql.*.sql; do
    84               psql -U {{ service_name }} \
    85                    -d {{ postgresql_databases[0].name }} \
    86                    -f $f \
    87                    -q;
    88           done"
     82  shell: "cat {{ web_root }}/vendor/sabre/dav/examples/sql/mysql.* | \
     83              mysql -u {{ mysql_users[0].name }} \
     84                    -p\"{{ mysql_users[0].password }}\" \
     85                    {{ mysql_databases[0].name }}"
    8986  when:
    9087    "first_run | default(false)"
  • roles/sabredav/templates/server.php

    rc9f3ebd0 r0c882bec  
    4141 */
    4242//$pdo = new \PDO('sqlite:data/db.sqlite');
    43 $pdo = new PDO('pgsql:dbname={{ db.name }};host={{ db.server }}', '{{ db.user }}', '{{ db.password }}');
     43$pdo = new PDO('mysql:dbname={{ db.name }};host={{ db.server }}', '{{ db.user }}', '{{ db.password }}');
    4444$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
    4545
Note: See TracChangeset for help on using the changeset viewer.