Deployment process from DEV to PROD VM

HI,

I have both a development VM and a production VM (built as per installation guide)

One of the processes that we run on development when we start the application up is

./bin/maintenance/build-assets.py indico --dev --watch (as per guide)

Within the local codebase on the development VM I have changed some code, and by restarting the application we can see the effects of our changes.

Can you please advise on what I need to do to copy from my development VM to my production VM (and where to place it) to allow me to port my changes from dev to prod.

I assume an rpm will need to be built / is being built? – can you please advice on any processes I need to undertake on dev VM as well to prepare the code for prod.

As you can tell, I am new to working both with Indico and the linux environment.

Also please note that when I say prod, we are of course gong via UAT first, but this has been configured just as out production VM has.

Buiild a wheel using ./bin/maintenance/build-wheel.py indico and install that on the production machine using pip install indico-*.whl

Some useful commandline arguments of this script:

  --no-assets           skip building assets
  --add-version-suffix  Add a local suffix (+yyyymmdd.hhmm.commit) to the
                        version

I would recommend you to use --add-version-suffix so each build has an increasing version number; that way you can easily install a later wheel the same way to update.

Tried above and got errors

[indico@centos indico]$ cd src
[indico@centos src]$ ./bin/maintenance/build-wheel.py indico 
Usage: build-wheel.py [OPTIONS] COMMAND [ARGS]...

Error: Invalid value for "--target-dir" / "-d": Directory "dist/" does not exist.
[indico@centos src]$ pwd
/home/indico/dev/indico/src
[indico@centos src]$ mkdir dist
[indico@centos src]$ ./bin/maintenance/build-wheel.py indico 
Traceback (most recent call last):
  File "./bin/maintenance/build-wheel.py", line 334, in <module>
    cli(obj={})
  File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "./bin/maintenance/build-wheel.py", line 250, in build_indico
    clean, output = git_is_clean_indico()
  File "./bin/maintenance/build-wheel.py", line 119, in git_is_clean_indico
    toplevel = list({x.split('.')[0] for x in find_packages(include=('indico', 'indico.*',))})
TypeError: find_packages() got an unexpected keyword argument 'include'

Seems to be a setuptools version issue. Can you check what version you are using?

setuptools (40.8.0) - got this from pip list

Can you just make sure that it is the case by running:

python -c "import setuptools;print setuptools.__version__"

env) [indico@centos indico]$
(env) [indico@centos indico]$ python -c “import setuptools;print setuptools.version
40.8.0
(env) [indico@centos indico]$

Sorry, I meant:

env python -c "import setuptools;print setuptools.__version__"

I notice last time i didnt run the build within the ‘env’ - do you want me to try that?

(env) [indico@centos indico]$ env python -c “import setuptools;print setuptools.version
40.8.0
(env) [indico@centos indico]$

Try to run the build-wheel.py script while having the virtualenv active.

And maybe double-check and run env python -c "import setuptools;print setuptools.__version__" outside of the virtualenv.

yep - that was the issue!!!

On my ‘prod’ machine where do i go to install it (directory wise) or is it just from default root dir?

(env) [indico@centos src]$ ./bin/maintenance/build-wheel.py indico
Error: working tree is not clean
 indico/core/config.py                        | 3 ++-
 indico/web/client/styles/partials/_main.scss | 4 ++--
 indico/web/templates/footer.html             | 7 +++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

but go nothing in my dist dir - where is the wheel file I need to copt ?

As the error message states

Error: working tree is not clean

you should either commit all changes or pass --ignore-unclean as an argument to the script.

1 Like

many thanks - owe you a beer sometime - it is doing loads more now - should be OK, will see how i get on.

1 Like

on my prod VM, I have inported my wheel file and run the pip command from /opt/indico (I created an env) but it seems to have messed everything up - didnt save the log!! -was that the correct folder to run it from?

the folder doesn’t matter as long as the virtualenv is active

hi,

sorry for a long delay in response - only just got back into this.

Have created whl on dev VM, copied to prod VM, started up env and run as follows - got errors - any ideas please?

(.venv) [indico@centos ~]$ pip install indico-2.2.dev0+20190423.1332.df161ea-py2-none-any.whl 
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Processing ./indico-2.2.dev0+20190423.1332.df161ea-py2-none-any.whl
Requirement already satisfied: Markdown==2.3.1 in ./.venv/lib/python2.7/site-packages (from indico==2.2.dev0+20190423.1332.df161ea) (2.3.1)
Collecting lxml[html5]==4.3.2 (from indico==2.2.dev0+20190423.1332.df161ea)
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5bdeb89610>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/lxml/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5bdeb89710>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/lxml/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5bdeb89290>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/lxml/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5bdeb9d910>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/lxml/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5bdeb9d590>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/lxml/
  Could not find a version that satisfies the requirement lxml[html5]==4.3.2 (from indico==2.2.dev0+20190423.1332.df161ea) (from versions: )
No matching distribution found for lxml[html5]==4.3.2 (from indico==2.2.dev0+20190423.1332.df161ea)
(.venv) [indico@centos ~]$ 

Your machine doesn’t seem to be able to connect to PyPI, so installing dependencies fails.

sorted that out - cheers

It seemed to run fine - no error messages etc - but when trying to go back in (after shutdown / rerstart - even manual restart of services) I get an Internal Server Error instead of login page - cannot see anything in log/celery.log or indigo.log

image

Do you get any errors when running indico shell?