OLD | NEW |
1 # This file is part of the Juju GUI, which lets users view and manage Juju | 1 # This file is part of the Juju GUI, which lets users view and manage Juju |
2 # environments within a graphical interface (https://launchpad.net/juju-gui). | 2 # environments within a graphical interface (https://launchpad.net/juju-gui). |
3 # Copyright (C) 2012-2013 Canonical Ltd. | 3 # Copyright (C) 2012-2013 Canonical Ltd. |
4 # | 4 # |
5 # This program is free software: you can redistribute it and/or modify it under | 5 # This program is free software: you can redistribute it and/or modify it under |
6 # the terms of the GNU Affero General Public License version 3, as published by | 6 # the terms of the GNU Affero General Public License version 3, as published by |
7 # the Free Software Foundation. | 7 # the Free Software Foundation. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, | 10 # ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 API_PORT = 8080 | 108 API_PORT = 8080 |
109 WEB_PORT = 8000 | 109 WEB_PORT = 8000 |
110 | 110 |
111 BASE_DIR = '/var/lib/juju-gui' | 111 BASE_DIR = '/var/lib/juju-gui' |
112 CURRENT_DIR = os.getcwd() | 112 CURRENT_DIR = os.getcwd() |
113 CONFIG_DIR = os.path.join(CURRENT_DIR, 'config') | 113 CONFIG_DIR = os.path.join(CURRENT_DIR, 'config') |
114 JUJU_AGENT_DIR = os.path.join(BASE_DIR, 'juju') | 114 JUJU_AGENT_DIR = os.path.join(BASE_DIR, 'juju') |
115 JUJU_GUI_DIR = os.path.join(BASE_DIR, 'juju-gui') | 115 JUJU_GUI_DIR = os.path.join(BASE_DIR, 'juju-gui') |
116 RELEASES_DIR = os.path.join(CURRENT_DIR, 'releases') | 116 RELEASES_DIR = os.path.join(CURRENT_DIR, 'releases') |
117 # Builtin server dependencies. The order of these requirements is important. | |
118 SERVER_DEPENDENCIES = ( | |
119 'futures-2.1.4.tar.gz', | |
120 'tornado-3.1.1.tar.gz', | |
121 'websocket-client-0.12.0.tar.gz', | |
122 # XXX frankban 2013-11-07: we are currently using a customized jujuclient | |
123 # version built from this branch: | |
124 # lp:~frankban/python-jujuclient/pickable-enverror. | |
125 'jujuclient-0.13.tar.gz', | |
126 # XXX frankban 2013-11-07: we are currently using a customized deployer | |
127 # version built from this branch: lp:~frankban/juju-deployer/guienv-fixes. | |
128 'juju-deployer-0.2.8.tar.gz', | |
129 ) | |
130 SERVER_DIR = os.path.join(CURRENT_DIR, 'server') | 117 SERVER_DIR = os.path.join(CURRENT_DIR, 'server') |
131 | 118 |
132 APACHE_CFG_DIR = os.path.join(os.path.sep, 'etc', 'apache2') | 119 APACHE_CFG_DIR = os.path.join(os.path.sep, 'etc', 'apache2') |
133 APACHE_PORTS = os.path.join(APACHE_CFG_DIR, 'ports.conf') | 120 APACHE_PORTS = os.path.join(APACHE_CFG_DIR, 'ports.conf') |
134 APACHE_SITE = os.path.join(APACHE_CFG_DIR, 'sites-available', 'juju-gui') | 121 APACHE_SITE = os.path.join(APACHE_CFG_DIR, 'sites-available', 'juju-gui') |
135 HAPROXY_CFG_PATH = os.path.join(os.path.sep, 'etc', 'haproxy', 'haproxy.cfg') | 122 HAPROXY_CFG_PATH = os.path.join(os.path.sep, 'etc', 'haproxy', 'haproxy.cfg') |
136 | 123 |
137 SYS_INIT_DIR = os.path.join(os.path.sep, 'etc', 'init') | 124 SYS_INIT_DIR = os.path.join(os.path.sep, 'etc', 'init') |
138 AGENT_INIT_PATH = os.path.join(SYS_INIT_DIR, 'juju-api-agent.conf') | 125 AGENT_INIT_PATH = os.path.join(SYS_INIT_DIR, 'juju-api-agent.conf') |
139 GUISERVER_INIT_PATH = os.path.join(SYS_INIT_DIR, 'guiserver.conf') | 126 GUISERVER_INIT_PATH = os.path.join(SYS_INIT_DIR, 'guiserver.conf') |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 with su('root'): | 533 with su('root'): |
547 service_control(HAPROXY, STOP) | 534 service_control(HAPROXY, STOP) |
548 service_control(APACHE, STOP) | 535 service_control(APACHE, STOP) |
549 remove_haproxy_setup() | 536 remove_haproxy_setup() |
550 remove_apache_setup() | 537 remove_apache_setup() |
551 | 538 |
552 | 539 |
553 def install_builtin_server(): | 540 def install_builtin_server(): |
554 """Install the builtin server code.""" | 541 """Install the builtin server code.""" |
555 log('Installing the builtin server dependencies.') | 542 log('Installing the builtin server dependencies.') |
556 for dependency_name in SERVER_DEPENDENCIES: | 543 deps = os.path.join(CURRENT_DIR, 'deps') |
557 dependency = os.path.join(CURRENT_DIR, 'deps', dependency_name) | 544 requirements = os.path.join(CURRENT_DIR, 'server-requirements.pip') |
558 with su('root'): | 545 # Install the builtin server dependencies avoiding to download requirements |
559 cmd_log(run('pip', 'install', dependency)) | 546 # from the network. |
| 547 with su('root'): |
| 548 cmd_log(run( |
| 549 'pip', 'install', '--no-index', '--no-dependencies', |
| 550 '--find-links', 'file:///{}'.format(deps), '-r', requirements |
| 551 )) |
560 log('Installing the builtin server.') | 552 log('Installing the builtin server.') |
561 setup_cmd = os.path.join(SERVER_DIR, 'setup.py') | 553 setup_cmd = os.path.join(SERVER_DIR, 'setup.py') |
562 with su('root'): | 554 with su('root'): |
563 cmd_log(run('/usr/bin/python', setup_cmd, 'install')) | 555 cmd_log(run('/usr/bin/python', setup_cmd, 'install')) |
564 | 556 |
565 | 557 |
566 def write_builtin_server_startup( | 558 def write_builtin_server_startup( |
567 gui_root, ssl_cert_path, serve_tests=False, sandbox=False, | 559 gui_root, ssl_cert_path, serve_tests=False, sandbox=False, |
568 builtin_server_logging='info', insecure=False): | 560 builtin_server_logging='info', insecure=False): |
569 """Generate the builtin server Upstart file.""" | 561 """Generate the builtin server Upstart file.""" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 """ | 812 """ |
821 missing = find_missing_packages(*packages) | 813 missing = find_missing_packages(*packages) |
822 if missing: | 814 if missing: |
823 if repository is not None: | 815 if repository is not None: |
824 log('Adding the apt repository {}.'.format(repository)) | 816 log('Adding the apt repository {}.'.format(repository)) |
825 install_extra_repositories(repository) | 817 install_extra_repositories(repository) |
826 log('Installing deb packages: {}.'.format(', '.join(missing))) | 818 log('Installing deb packages: {}.'.format(', '.join(missing))) |
827 cmd_log(apt_get_install(*missing)) | 819 cmd_log(apt_get_install(*missing)) |
828 else: | 820 else: |
829 log('No missing deb packages.') | 821 log('No missing deb packages.') |
OLD | NEW |