Exemple #1
0
 def schema(cls) -> Schema:
     return Schema({
         Optional('$ref'): str,  # reference to other Base documents
         Optional('str_field'): str,
         Optional('int_field'): int,
         Optional('level_dict'): {
             str: DocReference(Level)
         },
         Optional('level_array'): [DocReference(Level)],
         Optional('level_direct'): DocReference(Level),
         Optional('more'): lambda any: True
     })
Exemple #2
0
    def schema(cls) -> Schema:
        """
        name: str
            Unique name of the project.

        src: str
            Relative path of the source code directory (relative to riptide.yml).
            Services and Commands only get access to this directory.

        app: :class:`~riptide.config.document.app.App`
            App that this project uses.

        **Example Document:**

        .. code-block:: yaml

            project:
              name: test-project
              src: src
              app:
                $ref: apps/reference-to-app

        """
        return Schema({
            Optional('$ref'): str,  # reference to other Project documents
            Optional('$path'):
            str,  # Path to the project file, added by system after loading.
            'name': str,
            'src': str,
            'app': DocReference(App)
        })
Exemple #3
0
 def schema(cls) -> Schema:
     return Schema({
         Optional('$ref'): str,  # reference to other Level documents
         Optional('$name'): str,  # key if in a dict
         'name': str,
         Optional('base_ref'): DocReference(Base),
         Optional('more'): lambda any: True
     })
Exemple #4
0
    def schema(cls) -> Schema:
        """
        name: str
            Unique name of the project.

        src: str
            Relative path of the source code directory (relative to riptide.yml).
            Services and Commands only get access to this directory.

        app: :class:`~riptide.config.document.app.App`
            App that this project uses.

        [links]: List[str]
            Links to other projects (list of project names).

            Riptide will add all service containers in this project in the TCP/IP networks of all
            projects specified here. This way services in your project can communicate
            with services from other projects and vice-versa.
            If a project in this list does not exist, Riptide will ignore it.

            Please make sure, that service names are not re-used across projects that are linked this way, this could
            lead to unexpected results during service host name resolution.

        [default_services]: List[str]
            List of services to start when running `riptide start`. If not set, all services are started. You can also
            control which services to start using flags. See `riptide start --help` for more information.

        [env_files]: List[str]
            A list of paths to env-files, relative to the project path, that should be read-in by services and command
            when starting. See the ``read_env_file`` flag at :class:`~riptide.config.document.service.Service` and
            :class:`~riptide.config.document.command.Command` for more information.

            Defaults to ["./.env"].

        **Example Document:**

        .. code-block:: yaml

            project:
              name: test-project
              src: src
              app:
                $ref: apps/reference-to-app

        """
        return Schema({
            Optional('$ref'): str,  # reference to other Project documents
            Optional('$path'):
            str,  # Path to the project file, added by system after loading.
            'name': str,
            'src': str,
            'app': DocReference(App),
            Optional('links'): [str],
            Optional('default_services'): [str],
            Optional('env_files'): [str]
        })
Exemple #5
0
    def schema(cls) -> Schema:
        """
        proxy
            url: str
                Base-URL for the proxy server. The name of projects and/or services will be appended to it.

                For example `projectname.riptide.local` would route to the
                project `projectname` if `riptide.local` is specified.
            ports
                http: int
                    HTTP port that the proxy server should listen on
                https: Or[int,bool]
                    HTTPS port that the proxy server should listen on, or false to disable HTTPS

            autostart: bool
                Whether or not the proxy server should auto-start all services for a project
                if a user enters the URL for a service.

        engine: str
            Engine to use, the Python package for the engine must be installed.

        repos: List[str]
            List of URLs to Git repositories containing
            `Riptide Repositories </config_docs/using_repo/how_repositories.html>`_.

        update_hosts_file: bool
            Whether or not Riptide should automatically update the
            `system's host file </user_docs/3_installing.html#resolving-hostnames-permissions-for-the-etc-hosts-file>`_.

        [project]: :class:`~riptide.config.document.project.Project`
            If a project is loaded, Riptide inserts the project here. Do not manually insert a project
            into the actual system configuration file.

        **Example Document:**

        .. code-block:: yaml

            riptide:
              proxy:
                url: riptide.local
                ports:
                  http: 80
                  https: 443
                autostart: true
              engine: docker
              repos:
                - https://github.com/Parakoopa/riptide-repo.git
              update_hosts_file: true

        """
        return Schema({
            'proxy': {
                'url': str,
                'ports': {
                    'http': int,
                    'https': Or(int, False)  # False disables HTTPS
                },
                'autostart': bool,
                Optional('autoexit'): int  # TODO: Not used, deprecated.
            },
            'update_hosts_file': bool,
            'engine': str,
            'repos': [str],
            Optional('project'):
            DocReference(Project)  # Added and overwritten by system
        })
Exemple #6
0
    def schema(cls) -> Schema:
        """
        name: str
            Name describing this app.

        [notices]
            [usage]: str
                Text that will be shown when the interactive `setup wizard </user_docs/4_project.html>`_ ist started.

                This text should describe additional steps needed to finish the setup of the app and general
                usage notes.

            [installation]: str
                Text that will be shown, when the user selects a new installation (from scratch) for this app.

                This text should explain how to execute the first-time-setup of this app when using Riptide.

        [import]
            {key}
                Files and directories to import during the interactive setup wizard.

                target: str
                    Target path that the file or directory should be imported to,
                    relative to the directory of the riptide.yml

                name: str
                    Human-readable name of this import file. This is displayed during the interactive setup and should
                    explain what kind of file or directory is imported.

        [services]
            {key}: :class:`~riptide.config.document.service.Service`
                Services for this app.

        [commands]
            {key}: :class:`~riptide.config.document.command.Command`
                Commands for this app.


        **Example Document:**

        .. code-block:: yaml

            app:
              name: example
              notices:
                usage: Hello World!
              import:
                example:
                  target: path/inside/project
                  name: Example Files
              services:
                example:
                  $ref: /service/example
              commands:
                example:
                  $ref: /command/example
        """
        return Schema({
            Optional('$ref'): str,  # reference to other App documents
            'name': str,
            Optional('notices'): {
                Optional('usage'): str,
                Optional('installation'): str
            },
            Optional('import'): {
                str: {
                    'target': str,
                    'name': str
                }
            },
            Optional('services'): {
                str: DocReference(Service)
            },
            Optional('commands'): {
                str: DocReference(Command)
            }
        })
Exemple #7
0
    def schema(cls) -> Schema:
        """
        name: str
            Name describing this app.

        [notices]
            [usage]: str
                Text that will be shown when the interactive `setup wizard </user_docs/4_project.html>`_ ist started.

                This text should describe additional steps needed to finish the setup of the app and general
                usage notes.

            [installation]: str
                Text that will be shown, when the user selects a new installation (from scratch) for this app.

                This text should explain how to execute the first-time-setup of this app when using Riptide.

        [import]
            {key}
                Files and directories to import during the interactive setup wizard.

                target: str
                    Target path that the file or directory should be imported to,
                    relative to the directory of the riptide.yml

                name: str
                    Human-readable name of this import file. This is displayed during the interactive setup and should
                    explain what kind of file or directory is imported.

        [services]
            {key}: :class:`~riptide.config.document.service.Service`
                Services for this app.

        [commands]
            {key}: :class:`~riptide.config.document.command.Command`
                Commands for this app.

        [unimportant_paths]: List[str]
            Normally all files inside containers are shared with the host (for commands and services with role 'src').
            This list specifies files that don't need to be synced with the host. This means, that these files
            will only be uploaded to the container on start and changes will not be visible on the host. Changes that
            are made on the host file system may also not be visible inside the container. This increases performance
            on non-native platforms (Mac and Windows).

            This feature is only enabled if the system configuration performance setting ``dont_sync_unimportant_src``
            is enabled. If the feature is disabled, all files are shared with the host. See the documentation for that
            setting for more information.

            All paths are relative to the src of the project. Only directories are supported.


        **Example Document:**

        .. code-block:: yaml

            app:
              name: example
              notices:
                usage: Hello World!
              import:
                example:
                  target: path/inside/project
                  name: Example Files
              services:
                example:
                  $ref: /service/example
              commands:
                example:
                  $ref: /command/example
        """
        return Schema(
            {
                Optional('$ref'): str,  # reference to other App documents
                'name': str,
                Optional('notices'): {
                    Optional('usage'): str,
                    Optional('installation'): str
                },
                Optional('import'): {
                    str: {
                        'target': str,
                        'name': str
                    }
                },
                Optional('services'): {
                    str: DocReference(Service)
                },
                Optional('commands'): {
                    str: DocReference(Command)
                },
                Optional('unimportant_paths'): [str]
            }
        )
Exemple #8
0
    def schema(cls) -> Schema:
        """
        proxy
            url: str
                Base-URL for the proxy server. The name of projects and/or services will be appended to it.

                For example `projectname.riptide.local` would route to the
                project `projectname` if `riptide.local` is specified.
            ports
                http: int
                    HTTP port that the proxy server should listen on
                https: Or[int,bool]
                    HTTPS port that the proxy server should listen on, or false to disable HTTPS

            autostart: bool
                Whether or not the proxy server should auto-start all services for a project
                if a user enters the URL for a service.

            [autostart_restrict]: List[str]
                If set, only the IPv4 ip addresses specified by the netmasks in this list are allowed
                to trigger the auto-start process via the proxy server. For other clients, projects
                are not automatically started. Useful if you share a network with co-workers and don't
                want them to start your projects.

            [compression]: bool
                If true, the proxy server doesn't decompress any data, and instead passes the compressed
                data of the backend server (if compressed). Experimental.

        engine: str
            Engine to use, the Python package for the engine must be installed.

        repos: List[str]
            List of URLs to Git repositories containing
            `Riptide Repositories </config_docs/using_repo/how_repositories.html>`_.

        update_hosts_file: bool
            Whether or not Riptide should automatically update the
            `system's host file </user_docs/3_installing.html#resolving-hostnames-permissions-for-the-etc-hosts-file>`_.

        [project]: :class:`~riptide.config.document.project.Project`
            If a project is loaded, Riptide inserts the project here. Do not manually insert a project
            into the actual system configuration file.

        performance
            Various performance optimizations that, when enabled, increase the performance
            of containers, but might have some other drawbacks.

            Values can be true/false/auto.
            "auto" enables an optimization, if beneficial on your platform.

            dont_sync_named_volumes_with_host: Or['auto',bool]
                If enabled, volumes, that have a volume_name set, are not mounted to the host system
                and are instead created as volumes with the volume_name. Otherwise they
                are created as host path volumes only. Enabling this increases
                performance on some platforms.

                Please note, that Riptide does not delete named volume data for old projects.
                Please consult the documentation of the engine, on how to do that.

                "auto" enables this feature on Mac and Windows, when using the Docker
                container backend.

                Switching this setting on or off breaks existing volumes. They need to be
                migrated manually.

            dont_sync_unimportant_src: Or['auto', bool]
                Normally all Commands and Services get access to the entire source
                directory of a project as volume. If this setting is enabled,
                ``unimportant_paths`` that are defined in the App are not updated
                on the host system when changed by the volume. This means changes
                to these files are not available, but file access speeds may be
                drastically increased on some platforms.

                "auto" enables this feature on Mac and Windows, when using the Docker
                container backend.

                This feature can be safely switched on or off. Projects need to be
                restarted for this to take effect.

        **Example Document:**

        .. code-block:: yaml

            riptide:
              proxy:
                url: riptide.local
                ports:
                  http: 80
                  https: 443
                autostart: true
                autostart_restrict:
                  - 127.0.0.1/32
              engine: docker
              repos:
                - https://github.com/theCapypara/riptide-repo.git
              update_hosts_file: true
              performance:
                dont_sync_named_volumes_with_host: auto
                dont_sync_unimportant_src: auto

        """
        return Schema({
            'proxy': {
                'url': str,
                'ports': {
                    'http': int,
                    'https': Or(int, False)  # False disables HTTPS
                },
                'autostart': bool,
                Optional('autostart_restrict'): [str],
                Optional('compression'): bool,
                Optional('autoexit'): int  # TODO: Not used, deprecated.
            },
            'update_hosts_file': bool,
            'engine': str,
            'repos': [str],
            Optional('project'):
            DocReference(Project),  # Added and overwritten by system
            # Performance entries should be added by the system to the YAML file before validation if missing:
            'performance': {
                'dont_sync_named_volumes_with_host': Or(bool, 'auto'),
                'dont_sync_unimportant_src': Or(bool, 'auto')
            }
        })