Git Product home page Git Product logo

yandex-cloud / examples Goto Github PK

View Code? Open in Web Editor NEW
186.0 186.0 132.0 273.04 MB

Examples of code, configuration files etc. to be used with Yandex Cloud.

HCL 47.04% PowerShell 1.58% Shell 5.37% JavaScript 4.24% Python 6.91% Batchfile 0.01% Go 17.35% Java 3.51% Smarty 0.16% C# 0.83% CMake 0.03% C++ 1.18% Jupyter Notebook 8.11% Kotlin 0.23% HTML 1.14% CSS 0.38% TypeScript 1.73% Dockerfile 0.10% Jinja 0.08%

examples's People

Contributors

alena-linki avatar alexandrsurkov avatar anatolykraev avatar andreyst avatar antonyermilov avatar avhaliullin avatar azinovio avatar chaoticcube1 avatar daeremina avatar dtolmachev avatar dunmaksim avatar gennadyspb avatar golodnyj avatar j-kapinos avatar liannnix avatar makushevkm-doctat avatar maxdunaevsky-documentatio avatar mikhaildoc-documentat avatar mrdracon avatar myusosnovskay avatar nikolaymatrosov avatar patsevanton avatar redalka-cloud avatar rumnow avatar serjkanunnikov avatar slonn avatar userdeka avatar vitaly-belyakov avatar voloschuk-fedor avatar yandexiot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

yc-image-cleanup.sh поведение в случае незаполненной переменной YCCLEANUP_SYS_USER

https://github.com/yandex-cloud/examples/blob/master/products-prepare/linux/yc-image-cleanup.sh

    if [ ! -z "$YCCLEANUP_SYS_USER" ]; then
     ...
    fi
    echo "DONE"

Removing system user... DONE выводится вне зависимости от того был удален пользователь или нет.
Может стоит выводить предупрежение или писать SKIPPED вместо DONE?

Ещё можно было бы добавить опцию, которая возьмет имя системного пользователя из $SUDO_USER.

Ошибка при запуске примера попугая на python

Делаю всё, как указано на https://yandex.ru/dev/dialogs/alice/doc/quickstart-programming.html, однако при тестировании parrot.py возникает ошибка:

{
    "errorMessage": "argument of type 'NoneType' is not iterable",
    "errorType": "TypeError",
    "stackTrace": [
        "  File \"/function/runtime/runtime.py\", line 191, in handle_event\n    result = h(r.event, r.context)\n",
        "  File \"/function/code/parrot.py\", line 9, in handler\n    if 'request' in event and 'original_utterance' in event['request'] and len(event['request']['original_utterance']) > 0:\n"
    ]
}

Вот код:

def handler(event, context):
    """
    Entry-point for Serverless Function.
    :param event: request payload.
    :param context: information about current execution context.
    :return: response to be serialized as JSON.
    """
    text = 'Hello! I\'ll repeat anything you say to me.'
    if 'request' in event and 'original_utterance' in event['request'] and len(event['request']['original_utterance']) > 0:
        text = event['request']['original_utterance']
    return {
        'version': event['version'],
        'session': event['session'],
        'response': {
            # Respond with the original request or welcome the user if this is the beginning of the dialog and the request has not yet been made.
            'text': text,
            # Don't finish the session after this response.
            'end_session': 'false'
        },
    }

добавить в yc-image-cleanup.sh -с возможность выставления PasswordAuthentication в no

Сейчас yc-image-cleanup.sh -d проверяет, выставлена ли переменная PasswordAuthentication в конфиге sshd в значение no. Но нет кода который бы это мог бы сделать такое выставление автоматом. Нужно сделать по аналогии со сбросом PermitRootLogin:

function changeSSHRootLoginToDefault {
OS_TYPE=$(getOS)
if [ "$OS_TYPE" == "FreeBSD" ]; then
sed -i.bak "s/#*.PermitRootLogin.*/PermitRootLogin no/" /etc/ssh/sshd_config
rm -f /etc/ssh/sshd_config.bak
else
sed -i 's/.*PermitRootLogin.*/#PermitRootLogin No/g' /etc/ssh/sshd_config
echo "DONE"
fi
}

yc-image-cleanup.sh -d выдает ошибку после очистки образа через yc-image-cleanup.sh -с

Получаю ошибку:

Checking for SSH password authentication is disabled... FAIL;

Проблема в том, что перед этим yc-image-cleanup.sh -с очищает хостовые ключи:

Cама проверяющая функция вызывает sshd -T
CONF_VAULE=$(sshd -T 2>/dev/null | sed -n 's/^passwordauthentication \(.*\)/\1/p')
А sshd -T не стартует из-за очищенных ключей:

# sshd -T
sshd: no hostkeys available -- exiting.

В результате проверка по ошибке выдает FAIL.

Ну и в целом такая проверка выглядит не очень логично, т.к. в коде очистки есть только исправление значения PermitRootLogin

sed -i 's/.*PermitRootLogin.*/#PermitRootLogin No/g' /etc/ssh/sshd_config
но проверка при этом идет на PasswordAuthentication, надо бы эти вещи согласовать )

ExchangeServer2016-x64-cu12.iso does not exist in storage

I try packer build by packer-ansible-windows

And get error when use "source_image_family": "windows-2019-gvlk",

    yandex: fatal: [default]: FAILED! => {"changed": false, "module_version": "9.1.0", "msg": "PowerShell DSC resource DSC_xRemoteFile  failed to execute Set-TargetResource functionality with error message: Invoking web request failed with error. The remote server returned an error: (404) Not Found. ", "reboot_required": false}
  vars:
    uri_exch2016cu12: "https://storage.yandexcloud.net/msft-exchange/ExchangeServer2016-x64-cu12.iso"

https://github.com/yandex-cloud/examples/blob/master/packer-ansible-windows/ansible/exmb_prereq.yml#L5

But ExchangeServer2016-x64-cu12.iso does not exist in storage

Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'

ansible --version

ansible 2.6.17

packer build windows-ansible.json

yandex: output will be in this color.

==> yandex: Creating temporary ssh key for instance...
==> yandex: Using as source image: fd85s1nlcavgdpc16hj3 (name: "windows-2016-gvlk-1556619485", family: "windows-2016-gvlk")
==> yandex: Use provided subnet id b0c8pliu8o98kgtui3r3
==> yandex: Creating instance...
==> yandex: Waiting for instance with id ef333e47f9sh2fdfqd0a to become active...
    yandex: Detected instance IP: 178.154.234.144
==> yandex: Using winrm communicator to connect: 178.154.234.144
==> yandex: Waiting for WinRM to become available...
==> yandex: #< CLIXML
    yandex: WinRM connected.
==> yandex: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> yandex: Connected to WinRM!
==> yandex: Uploading /home/user/examples/packer-ansible-windows/setup_complete/ => C:\Windows\Setup\Scripts\
==> yandex: Provisioning with Ansible...
    yandex: Setting up proxy adapter for Ansible....
==> yandex: Executing Ansible: ansible-playbook -e packer_build_name="yandex" -e packer_builder_type=yandex --connection=packer --extra-vars ansible_shell_type=powershell ansible_shell_executable=None ansible_python_interpreter=/usr/bin/python -e ansible_ssh_private_key_file=/tmp/ansible-key064885685 -i /tmp/packer-provisioner-ansible611103632 /home/user/examples/packer-ansible-windows/ansible/exmb_prereq.yml
    yandex: /home/user/.local/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
    yandex:   from cryptography.exceptions import InvalidSignature
    yandex:
    yandex: PLAY [all] *********************************************************************
    yandex:
    yandex: TASK [Gathering Facts] *********************************************************
    yandex: ok: [default]
    yandex:
    yandex: TASK [download required modules] ***********************************************
    yandex: failed: [default] (item=xActiveDirectory) => {"changed": false, "item": "xActiveDirectory", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex: failed: [default] (item=xExchange) => {"changed": false, "item": "xExchange", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex: failed: [default] (item=xPSDesiredStateConfiguration) => {"changed": false, "item": "xPSDesiredStateConfiguration", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex: failed: [default] (item=NetworkingDsc) => {"changed": false, "item": "NetworkingDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex: failed: [default] (item=ComputerManagementDsc) => {"changed": false, "item": "ComputerManagementDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex: failed: [default] (item=StorageDsc) => {"changed": false, "item": "StorageDsc", "msg": "Problems adding package provider: No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.", "nuget_changed": false, "output": "", "repository_changed": false}
    yandex:     to retry, use: --limit @/home/user/examples/packer-ansible-windows/ansible/exmb_prereq.retry
    yandex:
    yandex: PLAY RECAP *********************************************************************
    yandex: default                    : ok=1    changed=0    unreachable=0    failed=1
    yandex:
==> yandex: Provisioning step had errors: Running the cleanup provisioner, if present...
==> yandex: Destroying instance...
    yandex: Instance has been destroyed!
==> yandex: Destroying boot disk...
    yandex: Disk has been deleted!
Build 'yandex' errored after 7 minutes 57 seconds: Error executing Ansible: Non-zero exit status: exit status 2

Проблема с окружением после создания версии функции

После создания версии функции из тестового примера examples/serverless/functions/YDB-connect-from-serverless-function/
при запуске тестирования ошибка (Среда выполнения node js 16, функция запускается в облаке)
{ "errorMessage": "Cannot find module '../package.json'\nRequire stack:\n- /function/code/node_modules/ydb-sdk/build/cjs/version.js\n- /function/code/node_modules/ydb-sdk/build/cjs/utils.js\n- /function/code/node_modules/ydb-sdk/build/cjs/discovery.js\n- /function/code/node_modules/ydb-sdk/build/cjs/driver.js\n- /function/code/node_modules/ydb-sdk/build/cjs/index.js\n- /function/code/database.js\n- /function/code/index.js", "errorType": "Error", "stackTrace": [ { "line": "Require stack:" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/version.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/utils.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/discovery.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/driver.js" }, { "line": "- /function/code/node_modules/ydb-sdk/build/cjs/index.js" }, { "line": "- /function/code/database.js" }, { "line": "- /function/code/index.js" }, { "function": "Function.Module._resolveFilename", "file": "node:internal/modules/cjs/loader", "line": 933, "column": 15 }, { "function": "Function.Module._load", "file": "node:internal/modules/cjs/loader", "line": 778, "column": 27 }, { "function": "Module.require", "file": "node:internal/modules/cjs/loader", "line": 1005, "column": 19 }, { "function": "require", "file": "node:internal/modules/cjs/helpers", "line": 102, "column": 18 }, { "function": "Object.<anonymous>", "file": "/function/code/node_modules/ydb-sdk/build/cjs/version.js", "line": 4, "column": 17 }, { "function": "Module._compile", "file": "node:internal/modules/cjs/loader", "line": 1103, "column": 14 }, { "function": "Object.Module._extensions..js", "file": "node:internal/modules/cjs/loader", "line": 1157, "column": 10 }, { "function": "Module.load", "file": "node:internal/modules/cjs/loader", "line": 981, "column": 32 }, { "function": "Function.Module._load", "file": "node:internal/modules/cjs/loader", "line": 822, "column": 12 }, { "function": "Module.require", "file": "node:internal/modules/cjs/loader", "line": 1005, "column": 19 } ] }

Несоответствие настройки порта документации в примере cicd-django

В документации говорится, что приложение должно запускаться на порте, указанном в переменной окружения ENV. Однако в примере, оно запускается на постоянном порте 8080. Это недочёт в примере или я что-то неверно понял?

ENTRYPOINT python manage.py runserver 8080

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.