Posts by DaveOB

    Should the php file be run as root?

    i have no idea ( subject unknown to me )


    I did try changing 'root' to 'pi' and the message was simply 'error occurred' and the details show :

    Code
    Error #0:
    OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export SHELL=/bin/sh; sudo --shell --non-interactive --user=pi -- docker exec nginx sudo -u pi php /config/www/www/EXDdata/exdgo.php 2>&1' with exit code '1': Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/nginx/json: dial unix /var/run/docker.sock: connect: permission denied in /usr/share/openmediavault/engined/rpc/cron.inc:177
    Stack trace:
    #0 /usr/share/php/openmediavault/rpc/serviceabstract.inc(588): Engined\Rpc\Cron->Engined\Rpc\{closure}('/tmp/bgstatuszG...', '/tmp/bgoutputz4...')
    #1 /usr/share/openmediavault/engined/rpc/cron.inc(181): OMV\Rpc\ServiceAbstract->execBgProc(Object(Closure))
    #2 [internal function]: Engined\Rpc\Cron->execute(Array, Array)
    #3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
    #4 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('execute', Array, Array)
    #5 /usr/sbin/omv-engined(537): OMV\Rpc\Rpc::call('Cron', 'execute', Array, Array, 1)
    #6 {main}

    Oh sorry:

    docker exec nginx sudo -u root php /config/www/www/EXDdata/exdgo.php

    still results in an error :


    Code
    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export SHELL=/bin/sh; sudo --shell --non-interactive --user=root -- docker exec nginx sudo -u root php /config/www/www/EXDdata/exdgo.php 2>&1' with exit code '126': OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"sudo\": executable file not found in $PATH": unknown

    You could either add cron to the docker container via a container mod.


    Or you could run it via schedule jobs in omv. With this method you need pass the command with docker exec. For example create a scheduled job as root: docker exec sudo -u abc php /config/www/myscript.php



    set the Command in the OMV Scheduled Tasks :


    Code
    docker exec sudo -u root php /config/www/www/EXDdata/exdgo.php

    Got this error :

    Code
    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; export SHELL=/bin/sh; sudo --shell --non-interactive --user=root -- docker exec sudo -u root php /config/www/www/EXDdata/exdgo.php 2>&1' with exit code '1': Error: No such container: sudo

    Problem with linux php ftp nginx portainer docker openmediavault problem.


    With some awesome assistance and guidance by Morlan, I have managed to get Nginx installed and can access the files.


    Next problem is uploading files using php ftp_put from the Nginx based php scripts, to a remote ftp web server.


    Was running OMV4 on RPi3B+ with Nginx as a plugin. Worked 100%.


    Upgraded to RPi4 4Gb and OMV5.


    OMV5 does not have plugin for Nginx, so has to be in a Container in Docker.


    So Installed Docker, Portainer, and created a Stack in Portainer for Nginx.


    In the stack script, I set the Volume to my existing Shared Folder, and I can map network drive to my PC and view & edit these files from my PC. All good so far.


    Started testing php script, and had to make a few small path changes, then everything worked 100%, except for an ftp_put command.


    The ftp connect and Login both work, but the ftp_put simply creates a zero sized file on the destination online ftp server, and after about a minute, then pc browser says : " 504 Gateway Time-out ".


    Found an error log that contains :

    2020/10/21 18:27:46 [error] 333#333: *1 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 192.168.1.91, server: _, request: "GET /EXDdata/testupload.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.136"


    I know this script worked perfectly when on the RPi3B+ on OMV4 with Nginx as a plugin, so I assume the problem is related to the new Pi, Docker, Portainer Container settings, or some config on Nginx.


    Anyone able to diagnose this ?

    something went wrong :


    ran this as a stack :


    seemed to install correctly, but ...

    when I browse to the IP from my PC ( 192.168.1.136 ) then I get a page saying :

    Code
    Welcome to our server
    
    The website is currently being setup under this address.

    but when I go to the shared www folder, it contains my original pages ( including the original index.html page ) and not this page that I am seeing.


    There are no new files in the www shared folder

    I can not get this to work, and know i must be missing something simple ( likely lack of understanding on my part )


    Just upgraded Pi3 ( OMV 4 ) to Pi4 and installed OMV 5 ( technoDad video guides ).


    Have Docker running, and Portainer installed.


    Used 'Add Templates' to create a Container for nginx


    I need ( want ) to use an existing Sharedfolder ( www/ ) that I have on the HDD that was used by nginx on the Pi3 and contains my html and php files.


    How do I tell nginx to use that folder ?


    I also want to be able to access that folder from my win PC, which I can do as the www/ folder is a shared folder and listed in SMB

    after a load of digging with Cloud Commander, I found the default index.html page here :

    /var/lib/docker/volumes/c045ac8ef091973de611ad602b647cbfdf8e8181d470b9ee2d13f26e60cb6a46/_data


    Verified by editing the file, changing a character, and saving. When viewed from my PC browser, the change is visible.


    So having found the location of the files, I tried adding the path as a Shared Folder in OMV5, and added to SMB so I can map as a network drive from my win PC.


    The network map connects, but I can't see any of the 3 files that are in the folder on the Pi.


    Is this a setting, or better solution - how do I specify the folder for nginx to use, as a different shared folder ?

    I am completely lost.

    Replacing Pi3B+ ( OMV4 ) with Pi4 ( OMV5 ), and found that I can't simply move the SD card from Pi3 to Pi4.

    Followed TechnoDad videos to get a new image on to the SD and install OMV. OK to this point.


    On the OMV4 / Pi3, I had nginx running as a plugin.


    If I understand correctly now, with OMV5, these plugins ( which had system wide access ) should now be run in a self-containing bubble, Docker.

    I guess Docker is the OS for these bubbles, and Portainer is the User Interface for the bubbles / dockers.


    So using Portainer > App Templates, I found nginx and 'Deploy Container' ( I assume this is the equivalent of an install )


    Next, went to Portainer > Containers and I see the "PiWeb' named container in the list.


    I can browse ( on my PC on same network ) to the IP of the Pi4, and I get the " Welcome to nginx " screen.


    On the Pi3, I had the web folder that nginx set as a shared folder, so that I can access it from my local PC as a network folder.


    The nginx plugin listed the server root as : /dev-disk-by-label-NAShd1/www/


    How / where do I change the settings in nginx / Portainer to use that same specific folder for the web pages ?

    If you have everything up to date it should be fine. You might have to run omv-firstaid if the network adapter doesn't get an IP address.

    Thanks. I use a mikrotik router so I think I can just delete the existing Static IP / MAC link, and create a new Static IP for the Pi based on the Pi's new MAC Address..

    Does this sound correct ?


    Starting to set up a small web server on my Pi.


    Installed Nginx, mySQL and php7


    Testing using php to send mail ( code known to work on another online php server ) and found I need a mail server installed.


    Dug around and found that Postfix is already installed - I guess that was added as part of OMV as I was able to send mails from OMV when that was the only thing running on the Pi.


    Could not get php to send mails - nothing worked and ( completely clueless ) tried for hours to find a way to make it work.


    Eventually I thought - maybe I should test the mail sending from OMV > System > Notifications just to check the Pi can actually send mail.


    The 'General Settings' was disabled ( probably because I didn't understand the mails it was sending me anyway ).


    As soon as I enabled it, a load of mails arrived on my PC from the php script. They must have been sitting in a queue somewhere.


    So it appears that the 'enabled' setting in OMV, also controls the sending of mail from php scripts.

    ok. I think this is working now


    messing around with some google searches, and came across this :


    First, remove the symlink you just created by running:


    Code
    rm -rf /usr/share/nginx/www


    That won’t delete phpMyAdmin, it’ll just delete the symlink. Now we’ll create a new one using:


    Code
    sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin


    which I edited to :

    Code
    sudo ln -s /usr/share/phpmyadmin/ /sharedfolders/www/phpmyadmin


    I can now browse to the myPhpAdmin page


    Hope this helps someone else in the future