### Starting Backslash Systemd Service (Shell) Source: https://github.com/getslash/backslash/blob/develop/docs/installation.rst This command manually starts the backslash-docker systemd service. The initial execution might take longer as Docker images need to be fetched from the internet. ```Shell systemctl start backslash-docker ``` -------------------------------- ### Installing Ember Application Dependencies Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md These commands clone the application repository, navigate into its directory, and install all necessary Node.js dependencies using npm. ```Shell git clone ``` ```Shell cd my-app ``` ```Shell npm install ``` -------------------------------- ### Building Frontend Application (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This sequence of commands navigates into the `webapp` directory, globally installs `ember-cli` if not present, installs frontend dependencies using `yarn`, and then builds the Ember.js application. This prepares the static assets for the web interface. ```shell cd webapp npm install -g ember-cli # only if you don't already have ember-cli yarn install ember build ``` -------------------------------- ### Starting Development Test Server (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command starts the Backslash test server using Pipenv. It serves the application locally, allowing developers to interact with the backend and the built frontend. ```shell pipenv run manage testserver ``` -------------------------------- ### Installing Development Dependencies with Pipenv (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command installs all project dependencies, including development dependencies, using Pipenv. It ensures the local environment is set up with all necessary packages for development. ```shell pipenv install -d ``` -------------------------------- ### Enabling Backslash Systemd Service (Shell) Source: https://github.com/getslash/backslash/blob/develop/docs/installation.rst These commands reload the systemd daemon to recognize the newly created unit file and then enable the backslash-docker service to start automatically on system boot. This ensures the service persists across reboots. ```Shell systemctl daemon-reload systemctl enable backslash-docker ``` -------------------------------- ### Downloading Backslash Docker Compose File (Shell) Source: https://github.com/getslash/backslash/blob/develop/docs/installation.rst These commands create a directory structure for Backslash and download the reference docker-compose.yml file from the official GitHub repository. This file is essential for defining and running Backslash's multi-container Docker application. ```Shell mkdir /opt/backslash mkdir /opt/backslash/docker curl https://raw.githubusercontent.com/getslash/backslash/master/docker/docker-compose.yml > /opt/backslash/docker/docker-compose.yml ``` -------------------------------- ### Running Ember Development Server Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md This command starts the Ember development server, making the application accessible locally for development and testing at http://localhost:4200. ```Shell ember serve ``` -------------------------------- ### Upgrading Backslash Docker Deployment (Shell) Source: https://github.com/getslash/backslash/blob/develop/docs/installation.rst These commands update the Backslash Docker image to the latest version from the registry and then restart the systemd service to apply the changes. This ensures the running Backslash instance is using the most recent code. ```Shell docker pull getslash/backslash sudo systemctl restart backslash-docker ``` -------------------------------- ### Configuring Backslash as Systemd Service Source: https://github.com/getslash/backslash/blob/develop/docs/installation.rst This systemd unit file defines the Backslash Docker service. It specifies dependencies on the Docker service, sets the working directory, and defines ExecStartPre, ExecStart, and ExecStop commands using docker-compose to manage the Backslash containers. This allows Backslash to run as a managed service. ```YAML # /etc/systemd/system/backslash-docker.service [Unit] Description=Backslash test reporting service Requires=docker.service After=docker.service [Service] Type=oneshot RemainAfterExit=yes WorkingDirectory=/opt/backslash/docker ExecStartPre=-/usr/local/bin/docker-compose -f docker-compose.yml -p backslash down ExecStart=/usr/local/bin/docker-compose -f docker-compose.yml -p backslash up -d ExecStop=/usr/local/bin/docker-compose -f docker-compose.yml -p backslash down [Install] WantedBy=multi-user.target ``` -------------------------------- ### Building Ember Application for Deployment Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md These commands compile the Ember application into static assets. The default build is for development, while specifying `--environment production` optimizes the output for production environments. ```Shell ember build ``` ```Shell ember build --environment production ``` -------------------------------- ### Running Project Tests (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command executes the test suite for the Backslash project using `make`. It runs all defined tests to verify the functionality and stability of the application. ```shell make test ``` -------------------------------- ### Deploying Backslash via Source Checkout with Docker Compose Source: https://github.com/getslash/backslash/blob/develop/INSTALLING.md This snippet demonstrates how to clone the Backslash repository and then build and run the application using `docker-compose` directly from the source. It builds the services and brings them up, creating a project named 'backslash'. ```Shell $ git clone https://github.com/getslash/backslash $ docker-compose -p backslash -f docker/docker-compose.yml up --build ``` -------------------------------- ### Creating PostgreSQL Database (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command creates a new PostgreSQL database named 'backslash' locally. It is a prerequisite for running the Backslash application, which requires a dedicated database instance. ```shell createdb backslash ``` -------------------------------- ### Executing Ember Application Tests Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md These commands run the application's test suite. The `--server` option keeps the test runner active in a browser for continuous testing during development. ```Shell ember test ``` ```Shell ember test --server ``` -------------------------------- ### Running Database Migrations with Pipenv (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command executes database migrations for the Backslash project using Pipenv. It updates the database schema to the latest version, ensuring compatibility with the application code. ```shell pipenv run manage db upgrade ``` -------------------------------- ### Building and Pushing a Backslash Docker Image Source: https://github.com/getslash/backslash/blob/develop/INSTALLING.md This snippet shows how to build a custom Docker image for Backslash without using cache, tagging it for a specific repository, and then pushing that image to a Docker registry. This allows for deployment from a locally hosted or private image. ```Shell $ docker build --no-cache -t your.repo/backslash -f docker/Dockerfile . $ docker push your.repo/backslash ``` -------------------------------- ### Accessing Ember Code Generator Help Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md This command displays detailed help information for Ember CLI's built-in code generators, which are used to scaffold various application components. ```Shell ember help generate ``` -------------------------------- ### Configuring Backslash Client with Slash Plugin - Python Source: https://github.com/getslash/backslash/blob/develop/docs/client_configuration.rst This snippet demonstrates the simplest way to configure the Backslash client within a Slash project. It installs the `BackslashPlugin` to report test executions to a specified Backslash server URL. Upon first execution, it initiates a browser-based login for authentication and run token retrieval. ```Python import slash.plugins from backslash.contrib.slash_plugin import BackslashPlugin slash.plugins.manager.install( BackslashPlugin( 'http://your.backslash.server', ), activate=True) ``` -------------------------------- ### Running Integration and UI Tests with Pytest (Shell) Source: https://github.com/getslash/backslash/blob/develop/README.md This command executes integration and UI tests using `pytest` via Pipenv. It targets the `integration_tests` directory, stops on the first failure (`-x`), specifies the application URL, and uses Chrome as the browser driver for UI tests. ```shell pipenv run pytest integration_tests -x --app-url http://127.0.0.1:8000 --driver Chrome ``` -------------------------------- ### Linting Ember Application Code Source: https://github.com/getslash/backslash/blob/develop/webapp/README.md These commands perform linting checks on Handlebars templates and JavaScript files to ensure code quality and adherence to style guidelines. The `--fix` option attempts to automatically correct identified issues. ```Shell npm run lint:hbs ``` ```Shell npm run lint:js ``` ```Shell npm run lint:js -- --fix ``` -------------------------------- ### Creating an Empty Docker Compose Override File (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet shows the basic structure for an empty Docker Compose override file (`compose-override.yml`). This file is used to extend or modify the main Backslash Docker Compose configuration, allowing for custom service definitions or environment variable overrides without altering the original setup. ```YAML # compose-override.yml version: '3' ``` -------------------------------- ### Defining a Custom Service in Docker Compose (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet demonstrates how to define a new custom service within a Docker Compose override file. The `my_custom_service` is configured with a specified Docker image and a command to execute upon startup, enabling the integration of auxiliary services like a Flask application into the Backslash deployment. ```YAML # compose-override.yml version: '3' services: my_custom_service: image: your-server/image-name command: "your-command-here" ``` -------------------------------- ### Defining Test Subjects for Backslash Session - Python Source: https://github.com/getslash/backslash/blob/develop/docs/client_configuration.rst This snippet demonstrates how to associate 'test subjects' with a Backslash session. By overriding the `_get_extra_session_start_kwargs` method, users can provide a list of dictionaries, each describing a subject with properties like name, product, version, and revision, which are then reported with the session. ```Python def _get_extra_session_start_kwargs(self): returned = super()._get_extra_session_start_kwargs() returned['subjects'] = [ { 'name': 'microwave1', 'product': 'Microwave', 'version': 'v1', 'revision': '123456', } ] return returned ``` -------------------------------- ### Adding Metadata Links to Test Pages (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet configures Backslash to display external links on test pages based on specific metadata keys. When a 'jenkins_url' metadata key is found for a test, a link named 'Jenkins build' with a specified icon will be added, providing quick access to external resources like Jenkins builds. This configuration enhances test result visibility. ```YAML ...test_metadata_links: - name: Jenkins build key: jenkins_url icon: http://url/for/jenkins/icon.png ``` -------------------------------- ### Displaying Test Metadata Items (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet specifies a metadata key to be displayed as an informational value on test pages. By defining `my_metadata_key` with a friendly `name`, Backslash will extract and show the value associated with this key, providing additional context directly on the test details page. ```YAML ...test_metadata_display_items: - key: my_metadata_key name: My Metadata Key ``` -------------------------------- ### Styling 404 Page Background and Text in CSS Source: https://github.com/getslash/backslash/blob/develop/flask_app/templates/errors/404.html This CSS snippet defines the visual appearance of a 404 error page. It sets a full-screen background image, styles the 'explanation' box with a semi-transparent background and shadow, and formats the 'errorcode' and 'caption' elements for a distinct look. ```CSS body { background: url(/static/img/404_bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } #explanation { color: black; background: rgba(255, 255, 255, 0.6); padding: 0.5em; box-shadow: 0px -1px 50px black; position: absolute; left: 0; width: 100%; bottom: 5%; font-size: xx-large; font-weight: bolder; line-height: 1.2em; } #errorcode { color: white; display: inline-block; font-size: 400%; font-family: 'Cinzel', serif; margin: 30px; } #caption { display: inline-block; font-size: x-large; font-weight: bolder; color: rgba(90, 186, 250, 0.8); text-shadow: 0 0 10px black; max-width: 1em; vertical-align: bottom; position: relative; top: -1em; left: -1em; } ``` -------------------------------- ### Displaying Session Metadata Items (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet specifies a metadata key to be displayed as an informational value on session pages. By defining `my_metadata_key` with a friendly `name`, Backslash will extract and show the value associated with this key, providing additional context directly on the session details page. ```YAML ...session_metadata_display_items: - key: my_metadata_key name: My Metadata Key ``` -------------------------------- ### Specifying Run Token for Backslash Plugin - Python Source: https://github.com/getslash/backslash/blob/develop/docs/client_configuration.rst This snippet shows how to explicitly provide a 'run token' when initializing the `BackslashPlugin`. This token is used by Backslash to identify the user and session, bypassing the default browser-based authentication flow for token retrieval. ```Python plugin = BackslashPlugin(..., runtoken='xxxxx...') ``` -------------------------------- ### Styling Explanation Box for 500 Error Page (CSS) Source: https://github.com/getslash/backslash/blob/develop/flask_app/templates/errors/500.html This CSS rule defines the appearance of an explanation box, likely for displaying error messages. It sets text color, a semi-transparent white background, padding, a shadow, and positions it absolutely at the bottom of the page with full width, ensuring the error message is prominent and readable. ```CSS #explanation { color: black; background: rgba(255, 255, 255, 0.6); padding: 0.5em; box-shadow: 0px -1px 50px black; position: absolute; left: 0; width: 100%; bottom: 5%; font-size: xx-large; font-weight: bolder; line-height: 1.2em; } ``` -------------------------------- ### Adding Custom Session Metadata to Backslash Plugin - Python Source: https://github.com/getslash/backslash/blob/develop/docs/client_configuration.rst This code illustrates how to add arbitrary JSON metadata to a Backslash test session. It involves subclassing `BackslashPluginBase` and overriding the `_get_initial_session_metadata` method to update the session's initial metadata dictionary before it's sent to the server. ```Python import slash.plugins from backslash.contrib.slash_plugin import BackslashPlugin as BackslashPluginBase class BackslashPlugin(BackslashPluginBase): def _get_initial_session_metadata(self): returned = super()._get_initial_session_metadata() returned.update({ 'environment_type': my_environment_type }) return returned slash.plugins.manager.install( BackslashPlugin( 'http://your.backslash.server', ), activate=True) ``` -------------------------------- ### Styling 403 Error Page Elements with CSS Source: https://github.com/getslash/backslash/blob/develop/flask_app/templates/errors/403.html This CSS snippet defines the visual presentation for various elements on a 403 Forbidden error page. It sets a full-screen background image, styles a semi-transparent explanation box, formats the '403' error code, and positions a small caption. ```CSS body { background: url(assets/img/403_bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } #explanation { color: black; background: rgba(255, 255, 255, 0.6); padding: 0.5em; box-shadow: 0px -1px 50px black; position: absolute; left: 0; width: 100%; bottom: 5%; font-size: xx-large; font-weight: bolder; line-height: 1.2em; } #errorcode { color: white; display: inline-block; font-size: 400%; font-family: 'Cinzel', serif; margin: 30px; } #caption { display: inline-block; font-size: x-large; font-weight: bolder; color: red; text-shadow: 0 0 10px black; max-width: 1em; vertical-align: bottom; position: relative; top: -2em; left: -1em; } ``` -------------------------------- ### Configuring Nginx to Route Custom APIs (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet shows how to configure the Nginx service within Docker Compose to forward specific API routes to a custom container. By setting the `BACKSLASH_ADDITIONAL_ROUTES` environment variable, requests to `/api/your_custom_api` will be proxied to `http://my_custom_service:8000`, enabling integration of custom backend services. ```YAML # compose-override.yml version: '3' services: ... nginx: environment: - "BACKSLASH_ADDITIONAL_ROUTES=/api/your_custom_api:http://my_custom_service:8000" ``` -------------------------------- ### Configuring Display Names in Backslash (YAML) Source: https://github.com/getslash/backslash/blob/develop/docs/server_configuration.rst This YAML snippet demonstrates how to customize the display names for 'Subjects' and 'Related' entities within Backslash. By setting `subject` to 'microwave' and `related` to 'plate', the UI will reflect these new terms in all relevant contexts. This configuration is typically placed in a `001-deployment.yml` file. ```YAML ...display_names: subject: microwave related: plate ``` -------------------------------- ### Styling Body Background for 500 Error Page (CSS) Source: https://github.com/getslash/backslash/blob/develop/flask_app/templates/errors/500.html This CSS rule sets a full-page background image for the HTML body, ensuring it covers the entire viewport without repetition. It includes vendor prefixes for broader browser compatibility for background sizing, making the error page visually consistent across different browsers. ```CSS body { background: url(assets/img/500_bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } ``` -------------------------------- ### Styling Caption Element for 500 Error Page (CSS) Source: https://github.com/getslash/backslash/blob/develop/flask_app/templates/errors/500.html This CSS rule styles a caption element, likely a small decorative or informational text. It sets display properties, font size, weight, color, maximum width, negative left margin for positioning, vertical alignment, and a text shadow for visual emphasis, making the caption stand out. ```CSS #caption { display: inline-block; font-size: large; font-weight: bolder; color: #ff0000; max-width: 1em; margin-left: -1em; vertical-align: top; text-shadow: 0px 0px 3px black, 2px 2px 0px #bb0000; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.