diff --git a/.squash.yml b/.squash.yml index 0189ebf..e1af458 100644 --- a/.squash.yml +++ b/.squash.yml @@ -5,110 +5,21 @@ deployments: TEST_VAL=42 ready_wait: 120 backend_wait: 20 - subdomain_port_mapping: - - test:81 - - test--test:81 - - another-test:8000 - - and--another-test:8000 - pre_terminate: - - uname -a - - ./src/scripts/script-2.sh - - stuff-service: - - cat ~/.bashrc - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo domain is $SQUASH_DOMAIN' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo branch id is $SQUASH_BRANCH_WITH_ID' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' + auto_deploy_disable_cache: true + auto_deploy_on_commits: true + auto_deploy_post_launch_commands: + default: + - echo true + - python ./selenium_test.py branch: vm_size: 1 - environment: - TEST_VAL=42 - ready_wait: - 120 - filename: - ./stuff/Dockerfile - dockerfileonly: true - run_options: --env TEST_VAL2=${SQUASH_BRANCH_WITH_ID} -v /assets:/assets - context_path: ./stuff - subdomains: - Awesome Name: - - awesomedomain,/?que=99764QQ - Awesomness x2: - - subd,/abc - Awesomness x3: - - plain - pre_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo domain is $SQUASH_DOMAIN' - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo domain is $SQUASH_DOMAIN' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo branch id is $SQUASH_BRANCH_WITH_ID' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' - branchA: - vm_size: 6 - environment: - TEST_VAL=4242 - ready_wait: - 120 - filename: - ./stuff/DockerfileA - dockerfileonly: true - run_options: --env TEST_VAL2=43 - context_path: ./stuff - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' - branchB: - vm_size: 8GB - environment: - TEST_VAL=424242 - ready_wait: - 120 - filename: - ./stuff/DockerfileB + vm_storage_gb: 10 + auto_deploy_disable_cache: true + auto_deploy_on_commits: false + ready_wait: 120 + filename: ./stuff/Dockerfile dockerfileonly: true - run_options: --env TEST_VAL2=${SQUASH_DOMAIN} context_path: ./stuff - post_launch: - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL2 is $TEST_VAL2' - - target: 'stuff-service' - command: exec - docker: true - options: -it {target} bash -c 'echo TEST_VAL is $TEST_VAL' + auto_deploy_post_launch_commands: + default: + - python ./selenium_test.py diff --git a/empty_file b/empty_file deleted file mode 100644 index ab9f299..0000000 --- a/empty_file +++ /dev/null @@ -1 +0,0 @@ -test132 diff --git a/stuff/Dockerfile b/stuff/Dockerfile index 4cff88c..e8cd13f 100644 --- a/stuff/Dockerfile +++ b/stuff/Dockerfile @@ -1,4 +1,6 @@ -FROM python:3.6.1-onbuild +FROM joyzoursky/python-chromedriver:3.6-selenium COPY . /usr/src/app +WORKDIR /usr/src/app +RUN pip install -r requirements.txt CMD ["bash", "run_server.sh"] diff --git a/stuff/DockerfileA b/stuff/DockerfileA deleted file mode 100644 index 73aaeb0..0000000 --- a/stuff/DockerfileA +++ /dev/null @@ -1,4 +0,0 @@ -FROM python:3.6.1-onbuild - -COPY . /usr/src/app -CMD ["python", "serverA.py"] diff --git a/stuff/DockerfileB b/stuff/DockerfileB deleted file mode 100644 index edbd01e..0000000 --- a/stuff/DockerfileB +++ /dev/null @@ -1,4 +0,0 @@ -FROM python:3.6.1-onbuild - -COPY . /usr/src/app -CMD ["python", "serverB.py"] diff --git a/stuff/requirements.txt b/stuff/requirements.txt index 7e10602..eefe40f 100644 --- a/stuff/requirements.txt +++ b/stuff/requirements.txt @@ -1 +1,2 @@ flask +selenium==3.13.0 diff --git a/stuff/selenium_test.py b/stuff/selenium_test.py new file mode 100644 index 0000000..1020e35 --- /dev/null +++ b/stuff/selenium_test.py @@ -0,0 +1,19 @@ +# !/usr/bin/env python3.6 +import os +import sys +from selenium import webdriver +from selenium.common.exceptions import NoSuchElementException + +chrome_options = webdriver.ChromeOptions() +chrome_options.add_argument('--no-sandbox') +chrome_options.add_argument('--window-size=1420,1080') +chrome_options.add_argument('--headless') +chrome_options.add_argument('--disable-gpu') +driver = webdriver.Chrome(chrome_options=chrome_options) +driver.get('https://{}'.format(os.environ.get('SQUASH_DOMAIN', ''))) +try: + driver.find_element_by_tag_name('body') + driver.close() + sys.exit(0) +except NoSuchElementException: + sys.exit(1) diff --git a/stuff/serverA.py b/stuff/serverA.py deleted file mode 100644 index e5f97ed..0000000 --- a/stuff/serverA.py +++ /dev/null @@ -1,31 +0,0 @@ -from flask import Flask -import threading -import time -import logging - -app = Flask(__name__) - - -@app.before_first_request -def activate_job(): - def run_job(): - while True: - logging.warning("Run recurring task") - time.sleep(0.25) - - thread = threading.Thread(target=run_job) - thread.start() - - -@app.route('/') -def index(): - return '
Hello world. SERVER A here. About this page.' - - -@app.route('/about') -def about(): - return 'This is the about page' - - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=80, debug=True) diff --git a/stuff/serverB.py b/stuff/serverB.py deleted file mode 100644 index f785e4d..0000000 --- a/stuff/serverB.py +++ /dev/null @@ -1,31 +0,0 @@ -from flask import Flask -import threading -import time -import logging - -app = Flask(__name__) - - -@app.before_first_request -def activate_job(): - def run_job(): - while True: - logging.warning("Run recurring task") - time.sleep(0.25) - - thread = threading.Thread(target=run_job) - thread.start() - - -@app.route('/') -def index(): - return 'Hello world from DOCKER B. About this page.' - - -@app.route('/about') -def about(): - return 'This is the about page' - - -if __name__ == "__main__": - app.run(host='0.0.0.0', port=80, debug=True) diff --git a/test b/test deleted file mode 100644 index e69de29..0000000