Uploading Logo to AWS Express Plus

Situation
Attempting to upload and overwrite “logo_1.png” or create new file in “Administration>System>Files” results in error: “Unable to create '/var/www/localhost/htdocs/openemr/sites/default/images/filename.png”

OpenEMR Version
I’m using OpenEMR version 6.0 Express pLus on AWS Docker

Browser:
Chrome Version 88.0.4324.104 64-bit and MS Edge

Operating System
I’m using: Windows 10

Logs
No information in logs found

hi @Jmiller, pretty sure the default permissions on that folder/directory are read and execute only.

dr-x------    2 apache   root          4096 Sep 18 00:41 images

You can remote in and change the perms on the parent dir and should be all set to upload.

ssh -i "private key" ubuntu@aws.com
sudo bash
docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh
chmod 700 /var/www/localhost/htdocs/openemr/sites/default/images/

That fixed the write error, but now it’s timing out.
But i think that’s a PHP memory issue thanks!

Hi,
I have exactly the same problem here. I am a doctor by trade, but found myself having to sort this for my new private clinic. Any step-by-step guide to upload my logo onto my cloud AWS based open-emr?

Thanks in advance

Hi, I’m running OpenEMR Express Plus (6.1) in AWS. I’m trying to upload logo files but am not able to properly navigate aws/ubuntu to upload the logo file from my local machine. I’ve been able to upload it to cloudshell, but can’t seem to get it from my user directory to the docker container.

I can navigate to var/www/localhost/htdocs/openemr # command line in cloudshell, but am struggling to figure out how to get to the images folder and how to upload the login_logo.gif file.

Thank you - pretty impressed with OpenEMR and the community 1 day in!

Also, fwiw - I did read the readme, but didn’t find anything specific on the steps to do this.

Hi, Dave.

There’s two file systems you need to navigate – the Ubuntu instance on AWS is the first one, but OpenEMR runs in a container on that instance, it has its own full file system. You’ll need to get your logo onto the instance and then you’ll need to copy the file from the instance into the container (see docker cp) and then probably move it where it needs to go in the container.

The example command lines for docker exec discuss how to connect to the container to operate or explore within it.

2 Likes

Ok - well, I’ve managed to do this - mostly.

tldr;

  1. The correct path for the “main” login-logo.svg file in 6.1 AWS Express Plus is: /var/www/localhost/htdocs/openemr/public/images

  2. Make sure you refresh your browser cache every time you make a change


First - for anyone trying to do this - remember to clear images from your cache every time you change something and re-test!

It seemed like there were two ways that might work. First, under admin/system/files, the first option is to “Upload Image to /var/www/localhost/htdocs/openemr/sites/default/images” That would have been a million times easier for me… if it had worked… but the site isn’t pulling the main login logo from that directory, so…

The Hard Way:

  1. Download and install WinScp.net to be able to secure FTP to Amazon EC2. I installed in “Commander Mode” which seemed intuitive. Login with
    File Protocol: SFTP
    Host Name: ec2-11-111-1-11.compute-1.amazonaws.com (use the instance Public IPv4 DNS from AWS)
    User Name: Ubuntu
    Password… I think this was the private key - ugh - not sure I can even remember.

  2. Create the file that you want to upload. Make Sure it is the Right Size! And Make Sure you name it exactly correctly. Caps matter! dash versus underscore matters! Gif vs. PNG vs. SVG matters. I found a lot of conflicting information, and ultimately uploaded about 6 different versions of Login-Logo, login-logo, login_logo, etc with different file extensions. Had I checked what files were there before I tried to upload, I would have had a better idea what I had to replace.

  3. Once you’ve connected and logged in, navigate to the folder with the files on the left, and go to someplace easy to get to on the right… Drag and drop the files.

  4. On windows on your local machine, open a cmd window and type
    ssh -i [pem file name] ubuntu@[your ip address]
    where [pem file name] = your AWS Key Pair
    and [your ip address] is the public IP address of your AWS instance
    ** If you get a “warning” UNPROTECTED PRIVATE KEY FILE message*** it is because the private key file is stored somewhere on windows with too many users able to access it. Store it someplace where only you have access. Remove inherited permissions in Windows*** Then try again

  5. Type “Sudo -i” (without quotes) to get to the root.

  6. Type “docker ps” which will give you the “Container ID” of the OpenEMR instance.

  7. OPTIONAL: Type "docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " “) /bin/sh” which gets you to the root directory inside the docker container. You can then navigate to the various folders and see what’s in them (e.g., what login_logo files exist.) When done type exit and hit enter, which gets you back to the root@ip… command prompt.

  8. For each file that you want to move into the images directory:
    type "docker cp [path]/[filename] [containerid]:/var/www/localhost/htdocs/openemr/sites/default/images/

where…
[path] = the path to where you saved the files when you uploaded them via winscp
[filename] = login-logo.svg or login_logo.gif… etc
[containerid] is the one that you looked up in step 6

Clear your images cache and go back to your public IP and see if it worked.

Note: After all the above, I learned after getting only one of my files to render that the directory paths seem to be incorrect. In 6.1 AWS Express Plus, I had to replace login-logo.svg in the following directory path: /var/www/localhost/htdocs/openemr/public/images

That did it (though I’m still struggling with some sizing / placement).

@Dave Were you ever able to get the placement figured out? My logo is going off the page.

Hey, Cody,

It’s great to see that someone found my post! Unfortunately, I never did sort out the logo placement. We were setting up the environment to test/demo, and getting that piece sorted was deprioritized.

Best of luck sorting it out!