Deployment process from DEV to PROD VM


#1

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.


#2

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.


#3

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'

#4

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


#5

setuptools (40.8.0) - got this from pip list


#6

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

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

#7

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


#8

Sorry, I meant:

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

#9

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


#10

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


#11

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.


#12

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 ?


#13

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.


#14

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


#15

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?


#16

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