posit-dev / publisher

MIT License
5 stars 0 forks source link

Deploying Flasgger API fails #793

Closed kgartland-rstudio closed 9 months ago

kgartland-rstudio commented 9 months ago

I'm adding all the python content we test with rsconnect-python to our BATS tests with the publisher and hitting an error when deploying Flasgger. The same app can be deployed successfully with rsconnect-python.

Flasgger App: https://github.com/rstudio/connect/tree/main/test/rsconnect-python/bundles/python-flasgger

Error:

Get "http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/": dial tcp: lookup connect_ip: no such host.

Verbose Logs:

publisher deploy test/sample-content/python/python-flasgger/ -a fuzz -v
time=2024-01-11T10:18:23.249-05:00 level=INFO msg="Client version" version=1.0.alpha1-100-g27c87b4a
time=2024-01-11T10:18:23.250-05:00 level=INFO msg="Development mode" mode=dev
time=2024-01-11T10:18:23.250-05:00 level=INFO msg="Development build" DevelopmentBuild=true
time=2024-01-11T10:18:23.250-05:00 level=INFO msg="Loading rsconnect accounts" path=/Users/kgartland/Library/Preferences/org.R-project.R/R/rsconnect
time=2024-01-11T10:18:23.252-05:00 level=INFO msg="Loading rsconnect-python accounts" path="/Users/kgartland/Library/Application Support/rsconnect-python/servers.json"
Deploy to server http://35.175.245.74:3939 using account fuzz and configuration default, creating deployment Untitled-2
time=2024-01-11T10:18:23.256-05:00 level=INFO msg="Publishing from directory" path=test/sample-content/python/python-flasgger/
time=2024-01-11T10:18:23.257-05:00 level=INFO msg="Starting deployment to server" event_phase=start event_op=publish server=http://35.175.245.74:3939
time=2024-01-11T10:18:23.257-05:00 level=INFO msg="Checking configuration against server capabilities" event_op=publish/checkCapabilities event_phase=start
Check Configuration...
time=2024-01-11T10:18:23.257-05:00 level=INFO msg="Testing authentication" event_op=publish/checkCapabilities method="Connect API key" url=http://35.175.245.74:3939
time=2024-01-11T10:18:23.374-05:00 level=INFO msg="Publishing with credentials" event_op=publish/checkCapabilities username=admin email=rsc@example.com
time=2024-01-11T10:18:24.006-05:00 level=INFO msg="Configuration OK" event_op=publish/checkCapabilities event_phase=success
[OK]
time=2024-01-11T10:18:24.006-05:00 level=INFO msg="Creating new deployment" event_op=publish/createNewDeployment event_phase=start
Create New Deployment...
time=2024-01-11T10:18:24.095-05:00 level=INFO msg="Created deployment" event_op=publish/createNewDeployment event_phase=success content_id=0e0d7960-35ac-47b3-bef1-b516569f0e25 save_name=Untitled-2
[OK]
time=2024-01-11T10:18:24.096-05:00 level=INFO msg="Preparing files" event_op=publish/createBundle event_phase=start
Prepare Files...
time=2024-01-11T10:18:24.097-05:00 level=INFO msg="Creating bundle from directory" event_op=publish/createBundle source_dir=/Users/kgartland/work/publishing-client/test/sample-content/python/python-flasgger
time=2024-01-11T10:18:24.103-05:00 level=INFO msg="Bundle created" event_op=publish/createBundle files=9 total_bytes=3695
time=2024-01-11T10:18:24.104-05:00 level=INFO msg="Done preparing files" event_op=publish/createBundle event_phase=success filename=/var/folders/qn/0zx6630d3b15_6jcdyl_20dc0000gp/T/bundle-1631296733.tar.gz
[OK]
time=2024-01-11T10:18:24.104-05:00 level=INFO msg="Uploading files" event_op=publish/uploadBundle event_phase=start
Upload Files...
time=2024-01-11T10:18:24.195-05:00 level=INFO msg="Done uploading files" event_op=publish/uploadBundle event_phase=success bundle_id=56
[OK]
time=2024-01-11T10:18:24.197-05:00 level=INFO msg="Updating deployment settings" event_op=publish/createDeployment event_phase=start content_id=0e0d7960-35ac-47b3-bef1-b516569f0e25 save_name=Untitled-2
Update Deployment Settings...
time=2024-01-11T10:18:24.285-05:00 level=INFO msg="Done updating settings" event_op=publish/createDeployment event_phase=success
[OK]
time=2024-01-11T10:18:24.285-05:00 level=INFO msg="Activating Deployment" event_op=publish/deployBundle event_phase=start
Activate Deployment...
time=2024-01-11T10:18:24.373-05:00 level=INFO msg="Activation requested" event_op=publish/deployBundle event_phase=success
[OK]
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="Building Python API..." source=server.log event_phase=start event_op=publish/restorePythonEnv
Restore Python environment...
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="Bundle created with Python version 3.11.6 is compatible with environment Local with Python version 3.11.4 from /opt/Python/3.11.4/bin/python3.11 " source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="Bundle requested Python version 3.11.6; using /opt/Python/3.11.4/bin/python3.11 which has version 3.11.4" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="2024/01/11 15:18:24.386427399 [rsc-session] Content GUID: 0e0d7960-35ac-47b3-bef1-b516569f0e25" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="2024/01/11 15:18:24.386450921 [rsc-session] Content ID: 46" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="2024/01/11 15:18:24.386455830 [rsc-session] Bundle ID: 56" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:24.461-05:00 level=INFO msg="2024/01/11 15:18:24.386459424 [rsc-session] Job Key: sEJ0zPjb99eIyuXv" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.478084440 Running on host: ip-172-98-22-45" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.483743931 Linux distribution: Ubuntu 22.04 LTS (jammy)" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.484913793 Running as user: uid=998(rstudio-connect) gid=999(rstudio-connect) groups=999(rstudio-connect)" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.484929156 Connect version: 2024.01.0-dev+35-gb6791937f1" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.484960606 LANG: C.UTF-8" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.484970985 Working directory: /opt/rstudio-connect/mnt/app" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.484982911 Building environment using Python 3.11.4 (main, Jul  5 2023, 13:45:01) [GCC 11.2.0] at /opt/Python/3.11.4/bin/python3.11" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.485426755 Using cached environment: 9l5fDN3cyvnd5b22Tz5ewQ" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.054-05:00 level=INFO msg="2024/01/11 15:18:24.826807745 Packages in the environment: attrs==23.2.0, bjoern==3.1.0, blinker==1.7.0, click==8.1.7, flasgger==0.9.7.1, Flask==3.0.0, itsdangerous==2.1.2, Jinja2==3.1.3, jsonschema==4.20.0, jsonschema-specifications==2023.12.1, MarkupSafe==2.1.3, mistune==3.0.2, packaging==23.2, PyYAML==6.0.1, referencing==0.32.1, rpds-py==0.16.2, six==1.16.0, Werkzeug==3.0.1, " source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.055-05:00 level=INFO msg="2024/01/11 15:18:24.826874378 Creating lockfile: python/requirements.txt.lock" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.644-05:00 level=INFO msg="Completed Python build against Python version: '3.11.4'" source=server.log event_op=publish/restorePythonEnv
time=2024-01-11T10:18:25.644-05:00 level=INFO msg=Done source=server.log event_phase=success event_op=publish/restorePythonEnv
[OK]
time=2024-01-11T10:18:25.644-05:00 level=INFO msg="Launching Python API..." source=server.log event_phase=start event_op=publish/runContent
Run Content...
time=2024-01-11T10:18:25.644-05:00 level=INFO msg=Done source=server.log event_phase=success event_op=publish/runContent
[OK]
time=2024-01-11T10:18:25.644-05:00 level=INFO msg="Validating Deployment" event_op=publish/validateDeployment event_phase=start
Test Deployment...
time=2024-01-11T10:18:26.619-05:00 level=ERROR msg="Get \"http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/\": dial tcp: lookup connect_ip: no such host" event_op=publish/validateDeployment event_phase=failure error_code=unknown Op=Get URL=http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/ Err="dial tcp: lookup connect_ip: no such host"
[ERROR]
time=2024-01-11T10:18:26.620-05:00 level=ERROR msg="Get \"http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/\": dial tcp: lookup connect_ip: no such host" event_op=publish event_phase=failure error_code=unknown URL=http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/ Err="dial tcp: lookup connect_ip: no such host" dashboard_url=http://35.175.245.74:3939/connect/#/apps/0e0d7960-35ac-47b3-bef1-b516569f0e25 Op=Get

Dashboard URL:  http://35.175.245.74:3939/connect/#/apps/0e0d7960-35ac-47b3-bef1-b516569f0e25

Get "http://connect_ip:3939/content/0e0d7960-35ac-47b3-bef1-b516569f0e25/apidocs/": dial tcp: lookup connect_ip: no such host.

The deployment works as expected with rsconnect-python:

> rsconnect deploy api ./test/sample-content/python/python-flasgger/ -n fuzz

Validating server...    [OK]
Validating app mode...  [OK]
Making bundle ...   [OK]
Deploying bundle ...    [OK]
Saving deployed information...  [OK]
Building Python API...
Bundle created with Python version 3.11.6 is compatible with environment Local with Python version 3.11.4 from /opt/Python/3.11.4/bin/python3.11
Bundle requested Python version 3.11.6; using /opt/Python/3.11.4/bin/python3.11 which has version 3.11.4
2024/01/11 15:17:26.743767155 [rsc-session] Content GUID: d7df9402-c135-439d-b209-b366db828d61
2024/01/11 15:17:26.743799325 [rsc-session] Content ID: 44
2024/01/11 15:17:26.743804661 [rsc-session] Bundle ID: 54
2024/01/11 15:17:26.743808406 [rsc-session] Job Key: Y0XOZqfzwLKfWT9B
2024/01/11 15:17:26.835671647 Running on host: ip-172-98-22-45
2024/01/11 15:17:26.841317306 Linux distribution: Ubuntu 22.04 LTS (jammy)
2024/01/11 15:17:26.842543732 Running as user: uid=998(rstudio-connect) gid=999(rstudio-connect) groups=999(rstudio-connect)
2024/01/11 15:17:26.842553549 Connect version: 2024.01.0-dev+35-gb6791937f1
2024/01/11 15:17:26.842588709 LANG: C.UTF-8
2024/01/11 15:17:26.842590158 Working directory: /opt/rstudio-connect/mnt/app
2024/01/11 15:17:26.842611682 Building environment using Python 3.11.4 (main, Jul  5 2023, 13:45:01) [GCC 11.2.0] at /opt/Python/3.11.4/bin/python3.11
2024/01/11 15:17:26.843083210 Using cached environment: 9l5fDN3cyvnd5b22Tz5ewQ
2024/01/11 15:17:27.179636323 Packages in the environment: attrs==23.2.0, bjoern==3.1.0, blinker==1.7.0, click==8.1.7, flasgger==0.9.7.1, Flask==3.0.0, itsdangerous==2.1.2, Jinja2==3.1.3, jsonschema==4.20.0, jsonschema-specifications==2023.12.1, MarkupSafe==2.1.3, mistune==3.0.2, packaging==23.2, PyYAML==6.0.1, referencing==0.32.1, rpds-py==0.16.2, six==1.16.0, Werkzeug==3.0.1,
2024/01/11 15:17:27.179697561 Creating lockfile: python/requirements.txt.lock
Completed Python build against Python version: '3.11.4'
Launching Python API...
Deployment completed successfully.
     Dashboard content URL: http://35.175.245.74:3939/connect/#/apps/d7df9402-c135-439d-b209-b366db828d61
     Direct content URL: http://35.175.245.74:3939/content/d7df9402-c135-439d-b209-b366db828d61/
Verifying deployed content...   [OK]
kgartland-rstudio commented 9 months ago

Closing as user error! I had forgotten to restart Connect in my script after setting the Server.Address so it was trying to hit connect_ip instead the actual IP Address.