Skip to content

Commit

Permalink
Set up apache caching
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTom committed Mar 4, 2019
1 parent 253ae8c commit cfe8789
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 8 deletions.
47 changes: 41 additions & 6 deletions README.md
@@ -1,4 +1,5 @@
# 🥒 [leihs][] Integration-Tests
🥒 [leihs][] Integration-Tests
==============================

[Executable Specifications](https://en.wikipedia.org/wiki/Behavior-driven_development#Behavioral_specifications) for the [**leihs** software system][leihs].

Expand All @@ -12,9 +13,44 @@
- [**Ubuntu**](https://www.ubuntu.com/server) linux operation system
- [**Ansible**](https://www.ansible.com/) software deployment, server provisioning, configuration management

---

## run locally

Reverse Proxy
-------------

### Caching

Prototyping and testing caching:

* must retrieve the whole file, i.e. use `tee`
* retrieve at least two times
* headers should correspond to the browner headers, e.g. "copy as curl"
* we announce caching via header for easier debugging rep verification

curl -i 'http://localhost:3200/my/css/fontawesome-free-5.0.13/css/fontawesome-all.css' -H 'Referer: http://localhost:3200/' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36' -H 'DNT: 1' --compressed | tee tmp/fontawesome-all.css | head -n 20

...
X-Cache: HIT from localhost
...


### Caveats

* disk cache seems only to work with absolute paths
* disk cache doesn't work if the "subdirectory" does not exists, e.g. `/tmp/apche-cache` will not work .i.g.;

* memory cache shmcb seems to work just by file size; don't know if there is any management at all

Whenever something is no right, you will get a "cache miss" and possibly some
"unwilling" note in the logs.




Vagrant
-------

### run locally

expose ports from inside VM/container on host machine:

Expand All @@ -39,7 +75,7 @@ until curl -k --fail -s https://localhost:${LEIHS_HOST_PORT_HTTPS}; do sleep 3;
bundle exec rspec ./spec
```

## debug selenium/webdriver/geckodriver/firefox setup
### debug selenium/webdriver/geckodriver/firefox setup

```sh
# start ruby repl
Expand All @@ -58,9 +94,8 @@ driver = Selenium::WebDriver.for :firefox, options: opts
driver.manage.window.resize_to(1024,768)
```

# TEMP

## Cider-CI traits install (ubuntu)
### Cider-CI traits install (ubuntu)

```sh
# vagrant
Expand Down
29 changes: 27 additions & 2 deletions reverse-proxy/conf/httpd_example.conf
Expand Up @@ -17,13 +17,18 @@ LoadModule proxy_http_module mod_proxy_http.so
LoadModule proxy_wstunnel_module mod_proxy_wstunnel.so
LoadModule unixd_module modules/mod_unixd.so

LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule cache_socache_module modules/mod_cache_socache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

###############################################################################
### Logging ###################################################################
###############################################################################

ErrorLog logs/error.log
LogLevel info
CustomLog logs/access.log "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
CustomLog logs/access.log "%h %l %u %t %{cache-status}e \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""


###############################################################################
Expand Down Expand Up @@ -62,7 +67,6 @@ Alias /assets ../../legacy/public/assets
</LocationMatch>



###############################################################################
### Reverse proxy #############################################################
###############################################################################
Expand Down Expand Up @@ -110,5 +114,26 @@ ProxyPass /procure http://localhost:${leihs_procure_client_port}/procu
## everything else goes to legacy
ProxyPass / http://localhost:${leihs_legacy_port}/ nocanon retry=0



###############################################################################
### Cache #####################################################################
###############################################################################

# DiskCache
# we don't use the disk cache, absolute paths are nasty to handle
CacheRoot /Users/thomas/Programming/LEIHS/leihs_v5/integration-tests/reverse-proxy/tmp/cache/cache

# in Memory cache
CacheSocache shmcb
CacheSocacheMaxSize 9999999

CacheEnable socache "/my"
CacheEnable socache "/admin"
CacheQuickHandler on
CacheHeader on

CacheIgnoreHeaders Set-Cookie Cookie Cookie2 X-Forwarded-For X-Forwarded-Host

# vim: syntax=apache

Empty file.

0 comments on commit cfe8789

Please sign in to comment.