Skip to content

Commit

Permalink
Split the Atos case-study into performance and functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fchauvel committed Sep 30, 2019
1 parent b99abba commit f676e47
Show file tree
Hide file tree
Showing 29 changed files with 1,109 additions and 6 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See explanation in the README.

FROM whatever:latest # Generate by CAMP
FROM camp/runtime


# Describe here how to install Citygo ontop of the "python" component.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '2'

services:

db:
build: ./postgres
container_name: my_postgresql
Expand Down Expand Up @@ -53,7 +54,7 @@ services:
- my-app-bridge

web:
build: ./dashboard
build: ./citygo
container_name: "my_web"
restart: always
environment:
Expand Down Expand Up @@ -100,8 +101,6 @@ services:
networks:
- my-app-bridge



mongo:
container_name: "my_mongo"
image: mongo:4.0.6-xenial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
version: '2'

services:

db:
build: ./postgres
container_name: my_postgres
Expand All @@ -26,6 +27,7 @@ services:
- "5432:5432"
expose:
- "5432"

web:
build: ./citygo
container_name: my_web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ services:
- web
networks:
- dsne-django-nginx

web:
build: ./app
build: ./citygo
container_name: "my_web"
restart: always
command: bash -c "python manage.py migrate --no-input && gunicorn citygo_settings.wsgi:application -b 0.0.0.0:80 --workers 3"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Installation of Python 2.7

FROM whatever # Replaced by CAMP during realization
# Replaced by CAMP during realization
FROM camp/runtime

RUN apt-get install -y --no-install-recommends python2.7 \
&& rm -rf /usr/bin/python \
Expand Down
107 changes: 107 additions & 0 deletions samples/stamp/atos/performance/camp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#
# CAMP
#
# Copyright (C) 2017, 2018 SINTEF Digital
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#

goals:
running:
- Entry

components:

browser:
provides_services: [ Entry ]
requires_services: [ Test ]
implementation:
docker:
file: browser/Dockerfile
tests:
command: pytest -v tests.py --junitxml=report.xml
reports:
location: "./"
pattern: ".xml"
format: junit

hub:
provides_services: [ Test ]
requires_services: [ CityGo ]
implementation:
docker:
image: selenium/hub

citygo:
provides_services: [ CityGo ]
requires_services: [ Postgres, Mongo ]
requires_features: [ Python ]
implementation:
docker:
file: citygo/Dockerfile

python:
provides_features: [ Python ]
requires_features: [ HttpProxy ]
implementation:
docker:
file: python/Dockerfile

apache:
provides_features: [ HttpProxy ]
requires_features: [ Ubuntu ]
variables:
thread_limit:
type: Integer
values: [ 64, 128 ]
realization:
- targets: [ docker-compose.yml ]
pattern: "ThreadLimit=64"
replacements: [ ThreadLimit=64, ThreadLimit=128 ]
threads_per_child:
type: Integer
values:
range: [0, 128]
coverage: 10
realization:
- targets: [ docker-compose.yml ]
pattern: ThreadsPerChild=25
replacements: ["ThreadsPerChild={value}"]
max_request_workers:
type: Integer
realization:
- targets: [ docker-compose.yml ]
pattern: MaxRequestWorkers=150
replacements: ["MaxRequestWorkers={value}"]
implementation:
docker:
file: repo/showcase/Dockerfile
implementation:
docker:
file: apache/Dockerfile

mongo:
provides_services: [ Mongo ]
implementation:
docker:
image: mongo:4.0.6-xenial


postgres:
provides_services: [ Postgres ]
implementation:
docker:
file: postgres/Dockerfile

ubuntu:
provides_features: [ Ubuntu ]
implementation:
docker:
image: ubuntu:latest

constraints:
- apache_0_threads_per_child.value < apache_0_thread_limit.value
- apache_0_max_request_workers.value == 16 * apache_0_threads_per_child.value
- Or([And([apache_0_threads_per_child.value >= 100, apache_0_max_request_workers.value >= 200]), And([apache_0_thread_limit.value <= 64, apache_0_max_request_workers.value >= 2])])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions samples/stamp/atos/performance/template/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM camp/runtime

MAINTAINER Fernando Mendez Requena <[email protected]>

RUN echo "sudo usermod -a -G user apache"

RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y \
libapache2-mod-wsgi \
python2.7 \
python-pip \
lynx \
apache2

RUN pip install mod_wsgi
RUN pip install virtualenv
ADD ./requirements.txt ./
RUN pip install -r requirements.txt

WORKDIR ./

ADD ./mpm_event.conf ./

#RUN mkdir -p /etc/httpd/sites-enabled
#RUN mkdir -p /etc/httpd/sites-available

ADD ./demo_site.conf /etc/apache2/sites-available/000-default.conf

#ADD ./httpd.conf /usr/local/apache2/conf/httpd.conf
#ADD ./httpd.conf /etc/httpd/conf/httpd.conf

CMD service apache2 relaod

RUN chmod 777 -R /var/log/apache2
RUN cd /etc/apache2/mods-enabled/ && \
echo "envsubst < $pwd/mpm_event.conf > ./mpm_event.conf"


EXPOSE 80 3500

CMD ["apache2ctl", "-D", "FOREGROUND"]

40 changes: 40 additions & 0 deletions samples/stamp/atos/performance/template/apache/demo_site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
WSGIPythonPath /var/www/html/ShowcaseServer/demo_site

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/ShowcaseServer

Alias /static /var/www/html/ShowcaseServer/demo_site/dashboard/static


WSGIScriptAlias / /var/www/html/ShowcaseServer/demo_site/citygo_settings/wsgi.py

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel debug

#CustomLog ${APACHE_LOG_DIR}/malaga_showcase_debug.log combined


# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
19 changes: 19 additions & 0 deletions samples/stamp/atos/performance/template/apache/mpm_event.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
StartServers ${StartServers}
MinSpareThreads ${MinSpareThreads}
MaxSpareThreads ${MaxSpareThreads}
ThreadLimit ${ThreadLimit}
ThreadsPerChild ${ThreadsPerChild}
MaxRequestWorkers ${MaxRequestWorkers}
MaxConnectionsPerChild ${MaxConnectionsPerChild}
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

7 changes: 7 additions & 0 deletions samples/stamp/atos/performance/template/browser/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM selenium/node-chrome-debug

RUN pip install selenium pytest

COPY ./tests citygo-tests/tests.py

CMD echo "Ready!"
Loading

0 comments on commit f676e47

Please sign in to comment.