-
When I test my flask API using a local host http://127.0.0.1:5001/, everything works fine. I followed the instruction here https://support.sas.com/ondemand/saspy.html for creating the sascfg_personal.py and .authinfo files. However, when testing the link of the deployed app, I get an internal server error. According to the azure log stream, there are problems accessing the .authinfo file. I included images of these error. I don't know what I have to do to properly configure and authenticate the sas session in this situation. In the repository that is getting deployed, I added the .authinfo file in a folder called root (a previous error in the log stream said it was searching for .authinfo in root). I added the sascfg_personal.py file inside the repository as well. For reference, the operating system on the azure web app is linux and the runtime stack is python 3.9. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 4 replies
-
Hey, I can help you with this. There's more than one way to work around something like this. First, this looks cool, looks like you have it working and all. The .authinfo file has to be in the users home directory, and it need permissions of 600 (rw- --- ---); only the user can access it. In a container, you are the root user, not whatever your user might be on you pc or anywhere else. So, the file needs to be in the users home directory. In the container that's /root. So, it looks like you created a directory named root down in the middle of wherever that content you have lives. I can't see from here what that filesystem path is. So, since it's not /root/.authinfo, it won't be found. If you can put it in the right place it ought to be picked up. If you can't make it be in the right place, you could just include the credentials in the config file. Since this is a container, that no one would have access to, to be poking around to find those in that , or any file, that would just work. Or, since this is python, you could just read them into env vars, or just python vars before issuing SASsession() and provide them as variables in that call. |
Beta Was this translation helpful? Give feedback.
-
Hey, no problem. So, in your repo, is that where you have your sascfg_personal.py file and all of the content shown in the picture above; the FLASK_BACKEND2 pic? That looks like a directory structure. I'm assuming in your config file you have something like this:
So, to provide credentials there, you would just comment out the authkey, and add omruser and omrpw to the config def you have. https://sassoftware.github.io/saspy/configuration.html#remote Where are you running this? How are you running this? I assumed it's running in a container since the log you showed has it running in linux as root. |
Beta Was this translation helpful? Give feedback.
-
Good deal! And yes, you still need sascfg_personal to have the SAS_config_names variable: https://sassoftware.github.io/saspy/configuration.html#sascfg-personal-py-details I've never used that service you're using to run your app in, but the documentation for it is in that fist line in that log: http://aka.ms/webapp-linux You may need to read that doc to understand how it works. You ought to be able to log into that container once it's up and explore it to see if/where java is, so you can provide the correct path to it. It may say where it's installed in the doc, don't know. Looks like you're close. That service is doing a ton of work for you, but then that means it's just a bunch of magic you aren't aware of, so you don't know what's really going on or how it's working. Still, the doc should help that part. It looks like you have a requirements.txt file in there, so if java isn't already in your container, which it may well be, you ought to be able to add it by just adding java to that file. You still need to know where it's installed so you can put that in your configurations definition. |
Beta Was this translation helpful? Give feedback.
-
Sure, it lets you ssh into the container, so you can see where java is installed. If it's not, add java to the requirements.txt file you have. Here's a link to their configuration doc for a python app, this section is about ssh'ing into the running container: https://learn.microsoft.com/en-us/azure/app-service/configure-language-python#open-ssh-session-in-browser |
Beta Was this translation helpful? Give feedback.
-
from inside the container, you can run these commands to see what java is there and where it is, I've just run it on one of my development machines to show you:
|
Beta Was this translation helpful? Give feedback.
-
Oh, of course requirements is only for python. I was thinking docker build dependencies. But, I dug around and found this, maybe this is the answer? https://learn.microsoft.com/en-us/answers/questions/991247/need-to-have-java-while-running-python-webapp-on-l |
Beta Was this translation helpful? Give feedback.
-
I made a docker container to house both python and java and it all worked out when I deployed to azure web apps. The other change I made was not using the .authinfo file for authentication, and just entering credentials into the sascfg_personal.py file, as Tom suggested in an answer above. This is the docker file that worked for me.
|
Beta Was this translation helpful? Give feedback.
-
That's awesome, way to go! You said: |
Beta Was this translation helpful? Give feedback.
I made a docker container to house both python and java and it all worked out when I deployed to azure web apps. The other change I made was not using the .authinfo file for authentication, and just entering credentials into the sascfg_personal.py file, as Tom suggested in an answer above. This is the docker file that worked for me.