0
votes

I am trying to deploy a rasa project described like here to google app engine, But the build failed due to some permission issues

The scripts try to create a folder inside container,

FROM rasa/rasa
ENV BOT_ENV=production

COPY . /var/www
WORKDIR /var/www

RUN rasa train

ENTRYPOINT [ "rasa", "run", "-p", "8080"]

I have added following permissions to google cloud build.

enter image description here

enter image description here

Error log frome cloud build.

Epochs: 100%|██████████| 100/100 [00:16<00:00,  6.04it/s, t_loss=1.485, i_loss=0.104, i_acc=1.000]
2020-05-31 18:05:25 INFO     rasa.utils.tensorflow.models  - Finished training.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Starting to train component EntitySynonymMapper
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Starting to train component ResponseSelector
2020-05-31 18:05:25 INFO     rasa.nlu.selectors.response_selector  - Retrieval intent parameter was left to its default value. This response selector will be trained on training examples combining all retrieval intents.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Finished training component.
2020-05-31 18:05:25 INFO     rasa.nlu.model  - Successfully saved model into '/tmp/tmpha6sd3hw/nlu'
Training Core model...
Core model training completed.
Training NLU model...
NLU model training completed.
Traceback (most recent call last):
  File "/opt/venv/bin/rasa", line 8, in <module>
    sys.exit(main())
  File "/opt/venv/lib/python3.7/site-packages/rasa/__main__.py", line 108, in main
    cmdline_arguments.func(cmdline_arguments)
  File "/opt/venv/lib/python3.7/site-packages/rasa/cli/train.py", line 77, in train
    nlu_additional_arguments=extract_nlu_additional_arguments(args),
  File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 52, in train
    nlu_additional_arguments=nlu_additional_arguments,
  File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
  File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 107, in train_async
    nlu_additional_arguments=nlu_additional_arguments,
  File "/opt/venv/lib/python3.7/site-packages/rasa/train.py", line 206, in _train_async_internal
    fixed_model_name=fixed_model_name,
  File "/opt/venv/lib/python3.7/site-packages/rasa/model.py", line 464, in package_model
    create_package_rasa(train_path, output_directory, fingerprint)
  File "/opt/venv/lib/python3.7/site-packages/rasa/model.py", line 258, in create_package_rasa
    os.makedirs(output_directory)
  File "/usr/local/lib/python3.7/os.py", line 223, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: 'models'
The command '/bin/bash -o pipefail -c rasa train' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

also facing the same issue when doing gcloud app deploy from cloud shell

my repo of the source code, need to remove cloudbuild.yaml before running gcloud app deploy

1
Are there any other logs that the cloud build shows? This message does not give any helpful details. Also have you enabled app engine on your project?Rafael Lemos
@ralemos see the complete log herePRAJIN PRAKASH
As you can see here on the troubleshoot cloud build documentation, if you get permission denied error in your deploy, you should disable and reenable the cloud build API to correct these permission issue to your service account, also double check if your service account has all the roles that seem relevant, you can check that here.Rafael Lemos
All that being said, if it still does not work, I believe that the issue is related to either the imports on your app or lack of permissions for the service account to read a specific folder on your staging bucket related to this error message Permission denied: 'models' . But then you would have to check your app's strucuture to check what is happening.Rafael Lemos
@ralemos I see th makedirs models makes this issue but why the permission error occurs.PRAJIN PRAKASH

1 Answers

2
votes

It was due to permission issue of the docker, fixed by adding the USER root

FROM rasa/rasa
USER root
ENV BOT_ENV=production

COPY . /var/www
WORKDIR /var/www

RUN rasa train

ENTRYPOINT [ "rasa", "run", "-p", "8080"]