Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
24
box/provisioning/roles/arknoll.selenium/.gitignore
vendored
Normal file
24
box/provisioning/roles/arknoll.selenium/.gitignore
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# IDE files #
|
||||
#################
|
||||
/.settings
|
||||
/.buildpath
|
||||
/.project
|
||||
/nbproject
|
||||
*.komodoproject
|
||||
*.kpf
|
||||
/.idea
|
||||
|
||||
# Other files #
|
||||
###############
|
||||
!empty
|
22
box/provisioning/roles/arknoll.selenium/.travis.yml
Normal file
22
box/provisioning/roles/arknoll.selenium/.travis.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
services: docker
|
||||
|
||||
env:
|
||||
- distro: centos7
|
||||
- distro: centos6
|
||||
- distro: ubuntu1604
|
||||
- distro: debian8
|
||||
- distro: ubuntu1404
|
||||
- distro: ubuntu1204
|
||||
|
||||
script:
|
||||
# Download test shim.
|
||||
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
|
||||
- chmod +x ${PWD}/tests/test.sh
|
||||
|
||||
# Run tests.
|
||||
- ${PWD}/tests/test.sh
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
13
box/provisioning/roles/arknoll.selenium/LICENSE.txt
Normal file
13
box/provisioning/roles/arknoll.selenium/LICENSE.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
Copyright (c) Alex Knoll
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
79
box/provisioning/roles/arknoll.selenium/README.md
Normal file
79
box/provisioning/roles/arknoll.selenium/README.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
## selenium [](https://travis-ci.org/arknoll/ansible-role-selenium)
|
||||
|
||||
Set up selenium and Firefox for running selenium tests.
|
||||
|
||||
#### Requirements
|
||||
|
||||
* `java`
|
||||
|
||||
#### Variables
|
||||
|
||||
* `selenium_install_dir`: [default: `/opt`] Install directory
|
||||
* `selenium_version`: [default: `2.53.0`] Install version
|
||||
* `selenium_install_firefox`: [default: `no`] Whether to install FireFox
|
||||
* `selenium_install_chrome`: [default: `yes`] Whether to install Google Chrome
|
||||
|
||||
## Dependencies
|
||||
|
||||
None
|
||||
|
||||
#### Example
|
||||
|
||||
```yaml
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- selenium
|
||||
```
|
||||
|
||||
#### Start/Stop/Restart Selenium
|
||||
|
||||
```
|
||||
$ service selenium start
|
||||
$ service selenium stop
|
||||
$ service selenium restart
|
||||
```
|
||||
|
||||
#### Known issue with Firefox
|
||||
|
||||
For some OS combinations the package manager version of Firefox
|
||||
doesn't work appropriately with Selenium. In these circumstances
|
||||
you may see an error like:
|
||||
|
||||
```
|
||||
WebDriver\Exception\UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
|
||||
```
|
||||
|
||||
Chrome and chromedriver don't appear to have this issue. If
|
||||
possible, use Chrome. If you still want to use firefox, then
|
||||
I suggest using https://galaxy.ansible.com/arknoll/firefox/
|
||||
to install an older version of firefox. (38.0 worked for me
|
||||
on Ubuntu 16.04).
|
||||
|
||||
#### License and Author
|
||||
|
||||
Author:: Alex Knoll (arknoll@gmail.com)
|
||||
|
||||
Copyright:: 2015, Alex Knoll
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
#### Contributing
|
||||
|
||||
We welcome contributed improvements and bug fixes via the usual workflow:
|
||||
|
||||
1. Fork this repository
|
||||
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||
4. Push to the branch (`git push origin my-new-feature`)
|
||||
5. Create a new pull request
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
# defaults file for selenium
|
||||
selenium_install_dir: /opt
|
||||
selenium_version: "2.53.0"
|
||||
selenium_install_firefox: no
|
||||
selenium_install_chrome: yes
|
||||
selenium_display_id: "1"
|
||||
selenium_port: 4444
|
||||
selenium_xvfb_args: "--server-args='-screen 0, 1920x1080x24'"
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
# handlers file for selenium
|
||||
- name: restart selenium
|
||||
service: name=selenium state=restarted
|
21
box/provisioning/roles/arknoll.selenium/meta/main.yml
Normal file
21
box/provisioning/roles/arknoll.selenium/meta/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
# meta file for selenium
|
||||
galaxy_info:
|
||||
author: Alex Knoll
|
||||
description: Set up selenium and Firefox for running selenium tests.
|
||||
license: Apache V2
|
||||
min_ansible_version: 2.0
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
categories:
|
||||
- web
|
||||
dependencies: []
|
106
box/provisioning/roles/arknoll.selenium/tasks/main.yml
Normal file
106
box/provisioning/roles/arknoll.selenium/tasks/main.yml
Normal file
|
@ -0,0 +1,106 @@
|
|||
---
|
||||
# Tasks file for selenium
|
||||
- name: Include OS-Specific variables
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
tags: [configuration, selenium]
|
||||
|
||||
- name: Install dependencies
|
||||
package: name=unzip
|
||||
tags: [configuration, selenium]
|
||||
|
||||
- name: create directory
|
||||
file: "path={{ selenium_install_dir }}/selenium state=directory recurse=yes"
|
||||
tags: [configuration, selenium, selenium-create-directory]
|
||||
|
||||
- name: Download Selenium
|
||||
get_url:
|
||||
url: "http://selenium-release.storage.googleapis.com/{{ selenium_version | regex_replace('\\.[0-9]+$', '') }}/selenium-server-standalone-{{ selenium_version }}.jar"
|
||||
dest: "{{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar"
|
||||
tags: [configuration, selenium, selenium-download]
|
||||
|
||||
- name: Install FireFox (if configured)
|
||||
package: name=firefox state=present
|
||||
when: selenium_install_firefox
|
||||
tags: [configuration, selenium, selenium-firefox]
|
||||
|
||||
- name: Add Chrome key (if configured, Debian)
|
||||
apt_key:
|
||||
url: "https://dl-ssl.google.com/linux/linux_signing_key.pub"
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian' and selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Add Chrome repo (if configured, Debian)
|
||||
apt_repository:
|
||||
repo: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'Debian' and selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Install Chrome (if configured, Debian)
|
||||
apt:
|
||||
name: google-chrome-stable
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian' and selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Install Chrome (if configured, RedHat)
|
||||
yum:
|
||||
name: https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat' and selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Get the latest release for chromedriver
|
||||
uri:
|
||||
url: http://chromedriver.storage.googleapis.com/LATEST_RELEASE
|
||||
return_content: yes
|
||||
register: chromedriver_latest
|
||||
when: selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Install chromedriver
|
||||
unarchive:
|
||||
src: "http://chromedriver.storage.googleapis.com/{{ chromedriver_latest.content | trim }}/chromedriver_linux64.zip"
|
||||
dest: /usr/bin
|
||||
mode: 0755
|
||||
copy: no
|
||||
when: selenium_install_chrome
|
||||
tags: [configuration, selenium, selenium-chrome]
|
||||
|
||||
- name: Install xvfb
|
||||
package: name={{ selenium_xvfb_package }}
|
||||
tags: [configuration, selenium, selenium-xvfb]
|
||||
|
||||
- name: Install init script
|
||||
template:
|
||||
src: "selenium-init-{{ ansible_os_family }}.j2"
|
||||
dest: /etc/init.d/selenium
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: "ansible_service_mgr != 'systemd'"
|
||||
tags: [configuration, selenium, selenium-install]
|
||||
|
||||
- name: Install systemd unit file (for systemd systems)
|
||||
template:
|
||||
src: "selenium-unit.j2"
|
||||
dest: /etc/systemd/system/selenium.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
when: "ansible_service_mgr == 'systemd'"
|
||||
tags: [configuration, selenium, selenium-install]
|
||||
|
||||
- name: Register systemd service status (for systemd systems)
|
||||
shell: 'systemctl status selenium | grep "active (running)"'
|
||||
when: "ansible_service_mgr == 'systemd'"
|
||||
register: selenium_running
|
||||
ignore_errors: yes
|
||||
changed_when: false
|
||||
|
||||
- name: Ensure selenium is running
|
||||
service: name=selenium state=started enabled=yes
|
||||
tags: [configuration, selenium, selenium-run]
|
||||
when: selenium_running.failed is defined and selenium_running.failed == true
|
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
### BEGIN INIT INFO
|
||||
# Provides: selenium
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: selenium
|
||||
# Description: selenium test framework
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
DISPLAY_ID="{{ selenium_display_id }}"
|
||||
RUN_AS=root
|
||||
|
||||
JAVA_BIN=/usr/bin/java
|
||||
|
||||
XVFB_BIN=/usr/bin/xvfb-run
|
||||
|
||||
SELENIUM_DIR={{ selenium_install_dir }}/selenium
|
||||
SELENIUM_JAR_FILE="$SELENIUM_DIR/selenium-server-standalone-{{ selenium_version }}.jar"
|
||||
DAEMON_PID_FILE="$SELENIUM_DIR/selenium.pid"
|
||||
SELENIUM_LOG_FILE="$SELENIUM_DIR/selenium.log"
|
||||
SELENIUM_DAEMON_OPTS=" -client -jar $SELENIUM_JAR_FILE -log $SELENIUM_LOG_FILE -port {{ selenium_port }}"
|
||||
|
||||
export DISPLAY="$DISPLAY_ID"
|
||||
|
||||
set -e
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if status_of_proc -p $DAEMON_PID_FILE "$SELENIUM_JAR_FILE" $SELENIUM_JAR_FILE > /dev/null; then
|
||||
log_progress_msg "Service already running"
|
||||
else
|
||||
log_daemon_msg "Starting Selenium server"
|
||||
log_progress_msg "selenium"
|
||||
start-stop-daemon -c $RUN_AS --start --quiet --background --pidfile $DAEMON_PID_FILE --make-pidfile --exec $XVFB_BIN {{ selenium_xvfb_args }} $JAVA_BIN -- $SELENIUM_DAEMON_OPTS
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
if status_of_proc -p $DAEMON_PID_FILE "$SELENIUM_JAR_FILE" $SELENIUM_JAR_FILE > /dev/null; then
|
||||
log_daemon_msg "Stopping Selenium server"
|
||||
log_progress_msg "selenium"
|
||||
DAEMON_PID=$(cat $DAEMON_PID_FILE)
|
||||
DAEMON_CHILDREN=$(pstree -l -p $DAEMON_PID |grep "([[:digit:]]*)" -o |tr -d '()')
|
||||
# Stop daemon itself.
|
||||
start-stop-daemon --stop --pidfile $DAEMON_PID_FILE
|
||||
# Stop all child processes.
|
||||
sudo kill $DAEMON_CHILDREN
|
||||
else
|
||||
log_progress_msg "Service not running"
|
||||
fi
|
||||
;;
|
||||
|
||||
restart|force-reload)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p $DAEMON_PID_FILE "$SELENIUM_JAR_FILE" $SELENIUM_JAR_FILE && exit 0 || exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
N=/etc/init.d/selenium
|
||||
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Selenium
|
||||
#
|
||||
# chkconfig: 345 90 25
|
||||
# description: Selenium service
|
||||
|
||||
# Source function library.
|
||||
. /etc/init.d/functions
|
||||
|
||||
java_bin=/usr/bin/java
|
||||
|
||||
xvfb_bin=/usr/bin/xvfb-run
|
||||
|
||||
selenium_dir={{ selenium_install_dir }}/selenium
|
||||
selenium_jar_file="$selenium_dir/selenium-server-standalone-{{ selenium_version }}.jar"
|
||||
user=root
|
||||
display="{{ selenium_display_id }}"
|
||||
exec="$xvfb_bin {{ selenium_xvfb_args }} --server-num=$display $java_bin"
|
||||
args=" -client -jar $selenium_jar_file -p {{ selenium_port }}"
|
||||
lockfile="/var/lock/subsys/selenium"
|
||||
pidfile="$selenium_dir/selenium.pid"
|
||||
logfile="$selenium_dir/selenium.log"
|
||||
prog="selenium"
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $prog: "
|
||||
|
||||
touch $pidfile
|
||||
chown $user $pidfile
|
||||
|
||||
touch $logfile
|
||||
chown $user $logfile
|
||||
|
||||
/bin/su - $user -c "DISPLAY=\":$display\" $exec $args >> $logfile 2>&1 & echo \$! > $pidfile"
|
||||
|
||||
sleep 2
|
||||
|
||||
pgrep -fl $prog
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && echo_success || echo_failure
|
||||
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc -p $pidfile $prog
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 2
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status -p ${pidfile} ${prog}
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=selenium test framework
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/xvfb-run {{ selenium_xvfb_args }} /usr/bin/java -client -jar {{ selenium_install_dir }}/selenium/selenium-server-standalone-{{ selenium_version }}.jar
|
||||
Restart=on-failure
|
||||
RestartSec=20s
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
11
box/provisioning/roles/arknoll.selenium/tests/README.md
Normal file
11
box/provisioning/roles/arknoll.selenium/tests/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Ansible Role tests
|
||||
|
||||
To run the test playbook(s) in this directory:
|
||||
|
||||
1. Install and start Docker.
|
||||
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
|
||||
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
|
||||
1. Make the test shim executable: `chmod +x tests/test.sh`.
|
||||
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
|
||||
|
||||
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- src: geerlingguy.java
|
20
box/provisioning/roles/arknoll.selenium/tests/test.yml
Normal file
20
box/provisioning/roles/arknoll.selenium/tests/test.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
# Test file for selenium
|
||||
- hosts: all
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=3600
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Don't install Chrome on old OSes.
|
||||
set_fact:
|
||||
selenium_install_firefox: yes
|
||||
selenium_install_chrome: no
|
||||
when: >
|
||||
(ansible_distribution == 'Ubuntu' and ansible_distribution_version == '12.04')
|
||||
or (ansible_os_family == 'RedHat' and ansible_distribution_version.split('.')[0] == '6')
|
||||
|
||||
roles:
|
||||
- geerlingguy.java
|
||||
- role_under_test
|
2
box/provisioning/roles/arknoll.selenium/vars/Debian.yml
Normal file
2
box/provisioning/roles/arknoll.selenium/vars/Debian.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
selenium_xvfb_package: xvfb
|
2
box/provisioning/roles/arknoll.selenium/vars/RedHat.yml
Normal file
2
box/provisioning/roles/arknoll.selenium/vars/RedHat.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
selenium_xvfb_package: xorg-x11-server-Xvfb
|
Loading…
Add table
Add a link
Reference in a new issue