Last active
February 4, 2019 06:24
-
-
Save AdrienLemaire/8bb0fa9a05b67f2242ff7f2004823f96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '3.4' # docker 17.09.0+ & docker-compose 1.23.2 | |
services: | |
backend: # For CMS & API | |
build: ../../GOunite-backend | |
command: python3 manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- ../../GOunite-backend:/code | |
- ../../GOunite-frontend/dist_integration:/xpc_test:ro | |
- ../../static:/static | |
ports: | |
- 8000:8000 # Dev runserver | |
- 8001:8001 # Behave test runner | |
depends_on: | |
- db | |
container_name: backend | |
reverse-proxy: | |
build: ./reverse-proxy | |
ports: | |
- 443:443 | |
- 8080:8080 | |
depends_on: | |
- backend | |
volumes: | |
- ./reverse-proxy/gounite.conf:/etc/nginx/conf.d/gounite.conf | |
container_name: nginx | |
networks: | |
default: | |
aliases: | |
- api.gounite.test | |
- xpc.gounite.test | |
selenium-hub: | |
image: selenium/hub:3.141.59-europium | |
ports: | |
- 4444:4444 | |
container_name: selenium-hub | |
environment: | |
- GRID_DEBUG=true | |
chrome: | |
# https://github.com/SeleniumHQ/docker-selenium#debugging | |
#image: selenium/node-chrome-debug:3.141.59-europium | |
image: selenium/node-chrome:3.141.59-europium | |
volumes: | |
- /dev/shm:/dev/shm | |
depends_on: | |
- selenium-hub | |
environment: | |
- HUB_HOST=selenium-hub | |
- HUB_PORT=4444 | |
- GRID_DEBUG=true | |
ports: # open VNC port for when using -debug | |
- 5900:5900 | |
container_name: chrome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from behave import fixture, use_fixture | |
from django.test import LiveServerTestCase | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from splinter.browser import Browser | |
@fixture(name="fixture.browser.chrome") | |
def splinter_browser(context): | |
context.browser = Browser( | |
driver_name="remote", | |
url="http://selenium-hub:4444/wd/hub", | |
**DesiredCapabilities.CHROME, | |
) | |
yield context.browser | |
context.browser.quit() | |
def before_feature(context, scenario): | |
context.fixtures = [ | |
"fixtures_subscriptions.json", | |
"fixtures_behave.yaml", | |
"fixtures_backstopjs.json", | |
] # behave-django | |
def before_tag(context, tag): | |
if tag == "fixture.browser.chrome": | |
use_fixture(splinter_browser, context) # behave | |
LiveServerTestCase.host = "0.0.0.0" # django | |
LiveServerTestCase.port = 8001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8080; | |
listen 443 ssl; | |
server_name api.gounite.dev api.gounite.test; | |
set $api_dev api.gounite.dev; | |
# Specify Docker DNS resolver when resolving integration test requests | |
resolver 127.0.0.11; | |
ssl_password_file /etc/nginx/certificates/rootCA.pass; | |
ssl_certificate /etc/nginx/certificates/server.crt; | |
ssl_certificate_key /etc/nginx/certificates/server.key; | |
set $proxy_pass http://backend:8001; | |
if ($host = $api_dev) { | |
set $proxy_pass http://backend:8000; | |
} | |
location / { | |
rewrite ^/(.*) /api/$1 break; | |
proxy_pass $proxy_pass; | |
proxy_http_version 1.1; | |
proxy_redirect off; | |
proxy_set_header Connection ""; | |
proxy_set_header Host $api_dev; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment