1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 21:27:25 +02:00

Salt state e107-dev now installs LAMP for acceptance tests

This commit is contained in:
Nick Liu
2019-12-28 15:36:45 +01:00
parent 20ed1ecb00
commit 4ca73daad5
4 changed files with 54 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
roster
cache/ cache/
logs/ logs/
var/ var/

View File

@@ -1,45 +1,56 @@
# Development Environment Deployment # e107 Local Test Container Setup
1. Launch a development container: 1. Launch a development container:
``` ```
lxc launch -s local images:ubuntu/focal e107-dev lxc launch -s local images:ubuntu/focal e107-dev
``` ```
2. Push your public SSH key: 2. Push your public SSH key:
``` ```
lxc file push --uid 0 --gid 0 -pv ~/.ssh/id_rsa.pub e107-dev/root/.ssh/authorized_keys lxc file push --uid 0 --gid 0 -pv ~/.ssh/id_rsa.pub e107-dev/root/.ssh/authorized_keys
``` ```
3. Install OpenSSH Server: 3. Install OpenSSH Server:
``` ```
lxc exec e107-dev -- apt install -y openssh-server lxc exec e107-dev -- apt install -y openssh-server
``` ```
4. Note the IP of the container: 4. Note the IP of the container:
``` ```
E107_DEV_HOST=$(lxc exec e107-dev -- hostname -I | cut -d' ' -f1) E107_DEV_HOST=$(lxc exec e107-dev -- hostname -I | cut -d' ' -f1)
``` ```
5. Generate the [Salt SSH](https://docs.saltstack.com/en/latest/topics/ssh/) [roster](https://docs.saltstack.com/en/latest/topics/ssh/roster.html): 5. Generate the [Salt SSH](https://docs.saltstack.com/en/latest/topics/ssh/) [roster](https://docs.saltstack.com/en/latest/topics/ssh/roster.html):
``` ```
echo "e107-dev: $E107_DEV_HOST" | tee roster echo "e107-dev: $E107_DEV_HOST" | tee roster
``` ```
6. Configure `e107_tests/config.yml` based on `e107_tests/config.sample.yml` (from the root of this repository). 6. Configure `e107_tests/config.yml` based on `e107_tests/config.sample.yml` (from the root of this repository).
Set `db.dbname`, `db.user`, and `db.password` to what you want the container configuration to have. For all tests:
Set `db.host` to the value of `$E107_DEV_HOST`. > Set `db.dbname`, `db.user`, and `db.password` to what you want the container configuration to have.
>
> Set `db.host` to the value of `$E107_DEV_HOST`.
For acceptance tests:
> Set `deployer` to `sftp`.
>
> Set `fs.host` to the value of `$E107_DEV_HOST`.
>
> Set `fs.user` to `www-data`.
>
> Set `fs.password` to any password you want the user to have.
>
> Set `fs.path` to `/var/www/html/e107/`.
>
> Set `url` to the output of `echo "http://$E107_DEV_HOST/e107/"`
7. Apply the container configuration: 7. Apply the container configuration:
``` ```

View File

@@ -1 +1 @@
e107-dev: 10.64.229.116 e107-dev: e107-dev.lxc

View File

@@ -1,8 +1,15 @@
Install MySQL server: Install LAMP stack:
pkg.installed: pkg.installed:
- pkgs: - pkgs:
- mariadb-server - mariadb-server
- python3-mysqldb - python3-mysqldb
- php
- libapache2-mod-php
- php-mysql
- php-xml
- php-curl
- php-gd
- php-mbstring
MySQL server configuration file: MySQL server configuration file:
file.managed: file.managed:
@@ -38,3 +45,27 @@ Create MySQL grants:
- database: {{ salt['pillar.get']('db:dbname') }}.* - database: {{ salt['pillar.get']('db:dbname') }}.*
- user: {{ salt['pillar.get']('db:user') }} - user: {{ salt['pillar.get']('db:user') }}
- host: '%' - host: '%'
Start and enable the web server:
service.running:
- name: apache2
- enable: True
- watch:
- pkg: Install LAMP stack
Configure Apache user:
user.present:
- name: {{ salt['pillar.get']('fs:user') }}
- password: {{ salt['pillar.get']('fs:password') }}
- hash_password: True
- shell: /bin/bash
Ensure docroot has the correct permissions:
file.directory:
- name: {{ salt['pillar.get']('fs:path') }}
- user: {{ salt['pillar.get']('fs:user') }}
- group: {{ salt['pillar.get']('fs:user') }}
- recurse:
- user
- group
- makedirs: True