Opalstack for ex-webfaction users or people looking for a Web2Py Web Hosting (Tutorial for Python 3 or 2.7)

373 views
Skip to first unread message

Carlos A

unread,
Oct 19, 2020, 11:48:38 PM10/19/20
to web2py-users
After the oficial announce from webfaction (goDaddy)  about the inminent shutdown of Web2Py support, I decided to migrate my Apps to Opalstack.com .

I want to share with you the procedure what I received from the support guys (It works!!!).

The initial web2py installer script is attached. There are a couple of manual steps that must be done before you can run the script:

  1. Go to https://my.opalstack.com/tokens/ and create an API token if you do not have one already. Make a note of the API token value.
  2. Go to https://my.opalstack.com/applications/ and create a new "Proxy Port" application. Make a note of the app's UUID. You can get the UUID by clicking the edit icon for the app in the app list and then retrieve the UUID from the last part of the edit page URL. For example if the edit page URL is https://my.opalstack.com/application/edit/abcd123-def234-123abc-678fed then the UUID is abcd123-def234-123abc-678fed.
  3. Upload the attached script to your app's shell user home directory on the server.
  4. Run the script as follows: python3 ~/web2py_install.py -u APP_UUID -t TOKEN (replace APP_UUID and TOKEN with the values from steps 1 and 2 above.)

The script will then install web2py for you, showing its progress as it goes.

After the script completes, you can then run the following commands to convert the application to Python 2.7 (be sure to change the app name to the name of your installed app):

pip2.7 install --user zipp==1.1
 pip2.7 install --user virtualenv==16.7.10 
cd ~/apps/appname 
mv env env.old 
virtualenv -p /bin/python2.7 env 
source env/bin/activate 
pip install uwsgi 
./stop 
./start


web2py_install.py

Gaël Princivalle

unread,
Oct 20, 2020, 3:50:13 AM10/20/20
to web2py-users
Thank you Carlos, I'll start this migration as soon as my Opalstack account will be a provisioned.
I've a doubt about the DBs. Opalstack offers MariaDB and PostgreSQL.
It seems that it's not so easy to use PostgreSQL.
I can switch my PostgreSQL DBs to MySQL, but in the connection string with MariaDB I have to use the standard MySQL one?
mysql://username:password@localhost/test?set_encoding=utf8mb4

Jose C

unread,
Oct 20, 2020, 4:17:37 AM10/20/20
to web2py-users
On Tuesday, 20 October 2020 at 08:50:13 UTC+1 gaelpri...@gmail.com wrote:
Thank you Carlos, I'll start this migration as soon as my Opalstack account will be a provisioned.
I've a doubt about the DBs. Opalstack offers MariaDB and PostgreSQL.
It seems that it's not so easy to use PostgreSQL.
I can switch my PostgreSQL DBs to MySQL, but in the connection string with MariaDB I have to use the standard MySQL one?
mysql://username:password@localhost/test?set_encoding=utf8mb4

Hi Gael,
There's really no difference to the way it worked on webfaction.  That link above was a version issue with the psycopg2 library and Antonio shared a way to install the latest psycopg2 version (as did I, using psycopg2-binary package).

I wouldn't change databases.

HTH,

Jose

Annet

unread,
Oct 20, 2020, 5:41:50 AM10/20/20
to web2py-users
Hi,

Jose, is right, I had the same problem: I did not go to my app directory prior to activating the virtualenv.
No need to switch databases.

Personally I prefer Opalstack's control panel over Webfaction's control panel. It's simpler and more powerful.

Best,

Annet
Op dinsdag 20 oktober 2020 om 10:17:37 UTC+2 schreef Jose C:

Gaël Princivalle

unread,
Oct 21, 2020, 5:46:03 AM10/21/20
to web2py-users
I've installed Web2py on Opalstack but the Web2py admin password is not the same as my shell one. How was it for you?

Jose C

unread,
Oct 21, 2020, 6:42:11 AM10/21/20
to web2py-users


On Wednesday, 21 October 2020 10:46:03 UTC+1, Gaël Princivalle wrote:
I've installed Web2py on Opalstack but the Web2py admin password is not the same as my shell one. How was it for you?

How did you install it? If you manually downloaded and installed it then the initial password creation procedure is detailed in:

If you used the script that Carlos posted above, then it generates a random password and should create a README file in your app directory with these contents:

                # Opalstack web2py README

               
Your web2py admin password is: {pw}

                A md5 hash of the admin password
is stored in:

                   
{appdir}/web2py/parameters_{appinfo["port"]}

               
Your web2py applications directory is:

                   
{appdir}/web2py/applications

               
The following scripts have been created to control
                your web2py uwsgi instance
:

                   
{appdir}/stop
                   
{appdir}/start

HTH,

Gaël Princivalle

unread,
Oct 21, 2020, 8:50:05 AM10/21/20
to web2py-users
Thank you José, I've found the README file and the password.
However this password is not accepted.
I've made another Web2py installation but the result is the same.

As this is quite the first step to migrate my Web2py websites to Opalstack I just would like to cry...

Jose C

unread,
Oct 21, 2020, 9:41:52 AM10/21/20
to web2py-users

On Wednesday, 21 October 2020 13:50:05 UTC+1, Gaël Princivalle wrote:
Thank you José, I've found the README file and the password.
However this password is not accepted.
I've made another Web2py installation but the result is the same.

As this is quite the first step to migrate my Web2py websites to Opalstack I just would like to cry...


Don't cry yet... it appears that the script and process worked ok for Carlos above given his (it works!!!!) comment so you must be close! 

Perhaps if you provide detailed steps of what you are doing and where you are trying to enter/use the password, someone may be able to help.

How are you starting web2py?
Are you activating the virtualenv first (that was created by the script)?  If so, it should appear within ( ) in your command prompt.
What error message(s) are you getting? At what point?


 

António Ramos

unread,
Oct 21, 2020, 10:21:03 AM10/21/20
to web...@googlegroups.com
me too am crying a litle....
just send email to sup...@opalstack.com
The response time is not as fast as webfaction support but maybe the are having a burst of clients from webfaction.

regards
António

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/66109b3b-57da-4b8a-8152-9bc701ec47b5o%40googlegroups.com.

Jose C

unread,
Oct 21, 2020, 10:40:36 AM10/21/20
to web2py-users

On Wednesday, 21 October 2020 15:21:03 UTC+1, Ramos wrote:
me too am crying a litle....
just send email to sup...@opalstack.com
The response time is not as fast as webfaction support but maybe the are having a burst of clients from webfaction.

Just looking at the volume on their forum and it looks like many people waited for the final announcement from WF to move... one guy alone is having to move 25 servers(!) each with lots of legacy apps over.  I think the support guys have their hands quite full at the moment. 

FWIW, in the 18 months I've been with them my support emails have generally all been answered within a two hour window.  I'm sure for the next few weeks this response time will suffer a bit.



Gaël Princivalle

unread,
Oct 21, 2020, 10:56:52 AM10/21/20
to web2py-users
> Are you activating the virtualenv first 
Yes I've followed all the points of the process.

 > What error message(s) are you getting? At what point? 
No error message. I'm just unable to login.
I'll do it again and check better each step.

Gaël Princivalle

unread,
Oct 21, 2020, 1:00:40 PM10/21/20
to web2py-users
I'm still trying again to install Web2py.
Executing the script I've these warnings:
Cache entry deserialization failed, entry ignored
You are using pip version 9.0.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

The pip version is definitely not a problem, the cache I don't know. Anyway the script ends with success, but the password don't allow me to login to the Web2py admin.
Perhaps Web2py can have also an easy way to change the admin password by the console...

Here is all the Putty session:
[user@vpsXX ~]$ python3 ~/web2py_install.py -u MY_UUID -t MY_TOKEN
[2020-10-21 16:45:09,326] INFO: Started installation of web2py app
[2020-10-21 16:45:09,953] INFO: Created directory /home/user/apps/web2py3/tmp
[2020-10-21 16:45:09,954] INFO: Running: /bin/python3.6 -m venv /home/user/apps/web2py3/env
[2020-10-21 16:45:13,379] INFO: Created virtualenv at /home/user/apps/web2py3/env
[2020-10-21 16:45:13,379] INFO: Running: /home/user/apps/web2py3/env/bin/pip install uwsgi
  Cache entry deserialization failed, entry ignored
You are using pip version 9.0.3, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[2020-10-21 16:45:34,599] INFO: Running: chmod 700 /home/user/apps/web2py3/env/bin/uwsgi
[2020-10-21 16:45:34,601] INFO: Installed latest uWSGI into virtualenv
[2020-10-21 16:45:34,602] INFO: Downloading http://www.web2py.com/examples/static/web2py_src.zip as /home/user/apps/web2py3/web2py_src.zip with permissions 0o600
[2020-10-21 16:45:35,752] INFO: Downloaded http://www.web2py.com/examples/static/web2py_src.zip as /home/user/apps/web2py3/web2py_src.zip with permissions 0o600
[2020-10-21 16:45:35,752] INFO: Running: /usr/bin/unzip -qq /home/user/apps/web2py3/web2py_src.zip
[2020-10-21 16:45:36,000] INFO: Downloaded web2py to /home/user/apps/web2py3/web2py
[2020-10-21 16:45:36,001] INFO: Running: cp /home/user/apps/web2py3/web2py/handlers/wsgihandler.py /home/user/apps/web2py3/web2py/
[2020-10-21 16:45:36,004] INFO: Prepared web2py WSGI handler
[2020-10-21 16:45:36,005] INFO: Created file /home/user/apps/web2py3/web2py/parameters_27923.py with permissions 0o600
[2020-10-21 16:45:36,005] INFO: Created web2py admin password file
[2020-10-21 16:45:36,006] INFO: Created file /home/user/apps/web2py3/uwsgi.ini with permissions 0o600
[2020-10-21 16:45:36,006] INFO: Created web2py uwsgi config
[2020-10-21 16:45:36,006] INFO: Created file /home/user/apps/web2py3/start with permissions 0o700
[2020-10-21 16:45:36,006] INFO: Created start script
[2020-10-21 16:45:36,006] INFO: Created file /home/user/apps/web2py3/stop with permissions 0o700
[2020-10-21 16:45:36,006] INFO: Created stop script
[2020-10-21 16:45:36,024] INFO: Running: crontab /home/user/.tmpOjBVPvrTP15oAuGpx4J6
[2020-10-21 16:45:36,041] INFO: Running: rm -f /home/user/.tmpOjBVPvrTP15oAuGpx4J6
[2020-10-21 16:45:36,044] INFO: Added cron job: */10 * * * * /home/user/apps/web2py3/start > /dev/null 2>&1
[2020-10-21 16:45:36,044] INFO: Created cron job
[2020-10-21 16:45:36,044] INFO: Created file /home/user/apps/web2py3/README with permissions 0o600
[2020-10-21 16:45:36,045] INFO: Running: /home/user/apps/web2py3/start
[uWSGI] getting INI configuration from /home/user/apps/web2py3/uwsgi.ini
[2020-10-21 16:45:36,824] INFO: Completed installation of web2py app web2py3
[2020-10-21 16:45:36,824] INFO: See /home/user/apps/web2py3/README for your admin password and other info.
[user@vpsXX ~]$ ^C
[user@vpsXX ~]$ pip2.7 install --user zipp==1.1
Requirement already satisfied (use --upgrade to upgrade): zipp==1.1 in ./.local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): contextlib2; python_version < "3.4" in ./.local/lib/python2.7/site-packages (from zipp==1.1)
You are using pip version 8.1.2, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[user@vpsXX ~]$ pip2.7 install --user virtualenv==16.7.10
Requirement already satisfied (use --upgrade to upgrade): virtualenv==16.7.10 in ./.local/lib/python2.7/site-packages
You are using pip version 8.1.2, however version 20.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[user@vpsXX ~]$ cd apps/web2py3
[user@vpsXX web2py3]$ mv env env.old
[user@vpsXX web2py3]$ virtualenv -p /bin/python2.7 env
Running virtualenv with interpreter /bin/python2.7
Already using interpreter /bin/python2.7
  No LICENSE.txt / LICENSE found in source
New python executable in /home/user/apps/web2py3/env/bin/python2.7
Also creating executable in /home/user/apps/web2py3/env/bin/python
Installing setuptools, pip, wheel...
done.
[user@vpsXX web2py3]$ source env/bin/activate
(env) [user@vpsXX web2py3]$ pip install uwsgi
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Processing /home/user/.cache/pip/wheels/98/8a/d9/e6390c0269fdba2d0381e508d675b8f2569baff923b42e2b15/uWSGI-2.0.19.1-cp27-cp27mu-linux_x86_64.whl
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.19.1
(env) [user@vpsXX web2py3]$ ./stop
Stopped.
(env) [user@vpsXX web2py3]$ ./start
[uWSGI] getting INI configuration from /home/user/apps/web2py3/uwsgi.ini
Started uWSGI for web2py3.

Jose C

unread,
Oct 21, 2020, 3:03:04 PM10/21/20
to web2py-users
Can you try this:

Edit the parameters_<portnum>.py file that was created and prepend 'md5$$' to the string of alphanum characters.
So it should now read (where the dots are the original text):
password='md5$$...........................................'

then stop and restart your app and see if you can login.

I'm just wondering if web2py is interpreting the hash as pbkdf2 instead of md5 (which is what the script creates).



Gaël Princivalle

unread,
Oct 21, 2020, 3:10:02 PM10/21/20
to web2py-users
Thank you Jose for your help. The Opalstack support have found an error in the install script, now it works fine.
' For some reason the install script stored the wrong password hash'

Jose C

unread,
Oct 21, 2020, 3:15:44 PM10/21/20
to web2py-users


On Wednesday, 21 October 2020 20:10:02 UTC+1, Gaël Princivalle wrote:
Thank you Jose for your help. The Opalstack support have found an error in the install script, now it works fine.
' For some reason the install script stored the wrong password hash

That's great!  Please post the new script here (or at least what line changed) so anyone else running into this problem can find it.

Gaël Princivalle

unread,
Oct 22, 2020, 3:42:56 AM10/22/20
to web2py-users
> That's great!  Please post the new script here (or at least what line changed) so anyone else running into this problem can find it.
I don't have it. I suggest for who wants to use it to always ask for the latest version to Opalstack.

Carlos A

unread,
Oct 25, 2020, 9:55:05 PM10/25/20
to web2py-users
Try this:

cd ~/apps/yourapp
source env/bin/activate
cd web2py/
python -c "from gluon.main import save_password; save_password(raw_input('admin password: '), <port_assigned_to_your_app>)"

Note: You can find your assigned port with the command  "ls"  inside of the web2py path and looking for the file:   parameters_<port_assigned_to_your_app>.py


Jose C

unread,
Oct 26, 2020, 3:41:13 AM10/26/20
to web2py-users


On Monday, 26 October 2020 01:55:05 UTC, Carlos A wrote:
Try this:

cd ~/apps/yourapp
source env/bin/activate
cd web2py/
python -c "from gluon.main import save_password; save_password(raw_input('admin password: '), <port_assigned_to_your_app>)"

Note: You can find your assigned port with the command  "ls"  inside of the web2py path and looking for the file:   parameters_<port_assigned_to_your_app>.py


Yep, that works and sets the password using a pbkdf2 hash which is web2py default.  Quick note for anyone following: if using py3 then raw_input above becomes just input.

Also, given the original thread title, noting here that they have created WF migration scripts to move databases, sites, etc. over.   See: https://community.opalstack.com/d/155-howto-migrate-stuff-automatically-from-webfaction

Lots of other useful info on their forums, especially the tutorial section:  https://community.opalstack.com/





Gaël Princivalle

unread,
Oct 26, 2020, 10:58:52 AM10/26/20
to web2py-users
Thank you Carlos that works perfectly.
Reply all
Reply to author
Forward
0 new messages