<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Mike,</p>
    <p><br>
    </p>
    <p>I am a little sick but your problems reminded me of some issues I
      had when trying to use pgadmin4, which also uses some sort of
      python virtual environment.</p>
    <p><br>
    </p>
    <p>This is an email I tried to send to the freebsd group but ran
      into some strange issue.  anyway, it details getting pgadmin4
      running in the python environment and I thought it might help.</p>
    <p>Again, I have been sick, so I apologize if this is irrelevant</p>
    <p><br>
    </p>
    <div class="aju">
      <div class="aCi"><img id=":e6_1-e" name=":e6"
src="https://www.google.com/s2/u/0/photos/private/AIbEiAIAAABECLCOksiu5_i7pgEiC3ZjYXJkX3Bob3RvKihhMjA3M2FkMDVkYzY2ODE5YTA2ZWNjZjllYTc0NjRlYjZlNDUzNDliMAHWuW1yufMgjvrrkpl2ak5wBO6Mqw?sz=32"
          class="ajn" data-hovercard-id="markmoellering@psyberation.com"
          data-name="Mark Moellering"></div>
    </div>
    <div class="gs">
      <div class="gE iv gt">
        <table class="cf gJ" cellpadding="0">
          <tbody>
            <tr class="acZ">
              <td class="gF gK">
                <table class="cf ix" cellpadding="0">
                  <tbody>
                    <tr>
                      <td class="c2">
                        <h3 class="iw"><span class="qu" role="gridcell"
                            tabindex="-1"><span name="Mark Moellering"
                              data-hovercard-id="markmoellering@psyberation.com"
                              class="gD">Mark Moellering</span> <span
                              class="go"><span><</span><a class="moz-txt-link-abbreviated" href="mailto:markmoellering@psyberation.com">markmoellering@psyberation.com</a><span>></span></span>
                          </span></h3>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </td>
              <td class="gH bAk">
                <div class="gK"><span></span><span id=":1c2" class="g3"
                    title="Feb 9, 2019, 2:02 PM" alt="Feb 9, 2019, 2:02
                    PM" role="gridcell" tabindex="-1">Sat, Feb 9, 2:02
                    PM</span></div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <table class="cf gJ" cellpadding="0">
      <tbody>
        <tr class="acZ">
          <td class="gH"><br>
          </td>
          <td class="gH acX bAm" rowspan="2"><br>
          </td>
        </tr>
      </tbody>
    </table>
    <table class="cf gJ" cellpadding="0">
      <tbody>
        <tr class="acZ xD">
        </tr>
      </tbody>
    </table>
    <table class="cf gJ" cellpadding="0">
      <tbody>
        <tr class="acZ xD">
          <td colspan="3">
            <table class="cf adz" cellpadding="0">
              <tbody>
                <tr>
                  <td class="ady">
                    <div class="iw ajw"><span class="hb">to <span
                          dir="ltr" name="freebsd-questions"
                          data-hovercard-id="freebsd-questions@freebsd.org"
                          class="g2">freebsd-questions</span> </span></div>
                    <div class="ajy" role="menuitem" tabindex="0"><img
                        class="ajz" id=":1bs" role="button"
                        src="https://mail.google.com/mail/u/0/images/cleardot.gif"
                        alt="" data-tooltip="Show details"></div>
                  </td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
      </tbody>
    </table>
    <div dir="ltr">Having just done this, I wanted to post this here, in
      case this will help others.<br>
      <br>
      This is based off of a Computing For Geeks article by Josphat
      Mutai, but I felt there were a couple of pieces missing.  <br>
      I installed this on my local development machine, "hal" in the
      examples, not the postgresql server but I don't think that should
      change much beyond the connection definitions once pgadmin4 is up
      and running.<br>
      <br>
      (original article)<br>
      <a
href="https://computingforgeeks.com/how-to-install-pgadmin4-on-freebsd-12/"
        target="_blank"
data-saferedirecturl="https://www.google.com/url?q=https://computingforgeeks.com/how-to-install-pgadmin4-on-freebsd-12/&source=gmail&ust=1556290999638000&usg=AFQjCNFCRdlTeOjknO4BRzd4yIlB_ngJQQ">https://computingforgeeks.com/<wbr>how-to-install-pgadmin4-on-<wbr>freebsd-12/</a><br>
      <br>
      pgadmin4 can use python 2.7 or 3.6  As python 2.7 has an end of
      life of Jan, 1 2020, I opted for python 3.6<br>
      <br>
      Pre-Installation Setup<br>
      <br>
      install python36 --                                     pkg
      install python36<br>
      install python pip package manager --     pkg install py36-pip<br>
      install python virtualenvironment --        pkg install
      py36-virtualenv<br>
      <br>
      Installing pgAdmin4<br>
      <br>
      As Root, go to /usr/local<br>
      <br>
      start a python virtual environment for pgadmin4:<br>
      <br>
      root@hal:/usr/local # virtualenv-3.6 pgadmin4<br>
      <br>
      Then run:<br>
       source pgadmin4/bin/activate  <br>
      <br>
      This did not work for me, so I had to use:<br>
      root@hal:/usr/local # source pgadmin4/bin/activate.csh<br>
      <br>
      Next, load the python dependancies through pip:<br>
      [pgadmin4] root@hal:/usr/local #pip install pyopenssl cryptography
      pyasn1  ndg-httpsclient <br>
      <br>
      Then, load sqlite3:<br>
      [pgadmin4] root@hal:/usr/local #pkg install py36-sqlite3<br>
      <br>
      Finally, install pgAdmin4 using pip.  Make sure to check for the
      latest version and directory:<br>
      [pgadmin4] root@hal:/usr/local #pip install <a
href="https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.2/pip/pgadmin4-4.2-py2.py3-none-any.whl"
        target="_blank"
data-saferedirecturl="https://www.google.com/url?q=https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.2/pip/pgadmin4-4.2-py2.py3-none-any.whl&source=gmail&ust=1556290999638000&usg=AFQjCNGURWM0Y5L8m-T1OFfCMRR2zr8AEQ">https://ftp.postgresql.org/<wbr>pub/<span
          class="il">pgadmin</span>/pgadmin4/v4.2/pip/<wbr>pgadmin4-4.2-py2.py3-none-any.<wbr>whl</a><br>
      (On my 8-core Ryzen, this took less than a minute.)<br>
      <br>
      Configuration and running<br>
      <br>
      To exit the python virtual environment, run:<br>
      #deactivate.  <br>
      <br>
      I exited the virtual environment at this point, but I don't think
      it is necessary.</div>
    <div dir="ltr"><br>
    </div>
    <div dir="ltr">next, in the directory:<br>
      root@hal:/usr/local/pgadmin4/<wbr>lib/python3.6/site-packages/<wbr>pgadmin4<br>
    </div>
    <div dir="ltr"><br>
    </div>
    run:<br>
    cp config.py to config_local.py  <br>
    - and edit the config_local.py file<br>
    <br>
    around line 140, it will have;<br>
    DEFAULT_SERVER = '127.0.0.1'<br>
    <br>
    THIS WILL NOT WORK.  You must change it to;<br>
    DEFAULT_SERVER = '0.0.0.0'         (or a static IP, if you have one)<br>
    <br>
    To run pgAdmin4, you must be in the python virtual environment, and
    then run the pgAdmin4.py script;<br>
    <br>
    root@hal:/usr/local # virtualenv-3.6 pgadmin4<br>
    root@hal:/usr/local # source pgadmin4/bin/activate.csh<br>
    [pgadmin4] root@hal:/usr/local # python
    ./pgadmin4/lib/python3.6/site-
    <div dir="ltr"><wbr>packages/pgadmin4/pgAdmin4.py<br>
      <br>
      It will ask for an email address and password the first time you
      run it, as displayed below;<br>
      <br>
      NOTE: Configuring authentication for SERVER mode.<br>
      <br>
      Enter the email address and password to use for the initial <span
        class="il">pgAdmin</span> user account:<br>
      <br>
      Email address: <a href="mailto:markmoellering@psyberation.com"
        target="_blank">markmoellering@psyberation.com</a><br>
      Password: <br>
      Retype password:<br>
      <span class="il">pgAdmin</span> 4 - Application Initialisation<br>
      ==============================<wbr>========<br>
      <br>
      Starting <span class="il">pgAdmin</span> 4. Please navigate to <a
        href="http://0.0.0.0:5050" target="_blank"
data-saferedirecturl="https://www.google.com/url?q=http://0.0.0.0:5050&source=gmail&ust=1556290999638000&usg=AFQjCNHTGtpR8JoYGYqZzWHDL-6W8iR_Cw">http://0.0.0.0:5050</a>
      in your browser.<br>
      <br>
      And it should work (it did for me at any rate).<br>
      <br>
      I went <a href="http://127.0.0.1:5050" target="_blank"
data-saferedirecturl="https://www.google.com/url?q=http://127.0.0.1:5050&source=gmail&ust=1556290999638000&usg=AFQjCNEc5byXw5xfwE_tSan_MBu282vOiw">http://127.0.0.1:5050</a>
      and was able to log in and attach to my remote server.  When I
      initially left the DEFAULT_SERVER = '127.0.0.1', I could login but
      then the web-stie would crash. I changed the setting to 0.0.0.0
      and then <a href="http://127.0.0.1:5050" target="_blank"
data-saferedirecturl="https://www.google.com/url?q=http://127.0.0.1:5050&source=gmail&ust=1556290999638000&usg=AFQjCNEc5byXw5xfwE_tSan_MBu282vOiw">http://127.0.0.1:5050</a>
      worked as expected.  I haven't written an rc script for it yet but
      I may in the future.<br>
      <br>
      I hope this helps someone.  While the original instructions by
      Josphat Mutai were quite good, there were just a couple of gotchas
      that I thought should be explained in more detail</div>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 4/24/19 4:31 PM, Mike Wayne wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20190424203128.GI60764@post.wayne47.com">
      <pre class="moz-quote-pre" wrap="">
Trying to set up a new machine with Ansible. I think I'm
missing something:
   Doing anything in a virtual python environment like:
      <a class="moz-txt-link-freetext" href="https://serversforhackers.com/c/an-ansible2-tutorial">https://serversforhackers.com/c/an-ansible2-tutorial</a>
   fails utterly.

   By running it globally, I can get a little further but even
   a simple package install fails:

$ cat freebsdpkg.yml:
- hosts: jails
  tasks:
      - name: Add packages on FreeBSD
        pkgng:
            name: wget

TASK [Add packages on FreeBSD] ********************************************************************************************************************************************************
fatal: [192.186.3.145]: FAILED! => {"changed": false, "msg": "Could not update catalogue"}


Is Ansible simply not ready for prime time? 

_______________________________________________
Semibug mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Semibug@lists.nycbug.org">Semibug@lists.nycbug.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nycbug.org:8080/mailman/listinfo/semibug">http://lists.nycbug.org:8080/mailman/listinfo/semibug</a>
</pre>
    </blockquote>
  </body>
</html>