InstallationInstructions
Version 43 (diabeteman, May 07, 2012 05:48 pm)
| 1 | 4 | diabeteman | h1. How to install EVE Corporation Management? |
|---|---|---|---|
| 2 | 5 | diabeteman | |
| 3 | 1 | tash | {{toc}} |
| 4 | 1 | tash | |
| 5 | 1 | tash | h2. Supported Operating Systems |
| 6 | 1 | tash | |
| 7 | 1 | tash | |
| 8 | 1 | tash | I only tested the installation into Apache with modWSGI on linux debian 5 (I guess it works on any unix like OS, even mac OS). However, on Windows, I cannot guarantee it will work... |
| 9 | 1 | tash | |
| 10 | 1 | tash | |
| 11 | 1 | tash | h2. Dependencies |
| 12 | 1 | tash | |
| 13 | 1 | tash | |
| 14 | 1 | tash | First thing is to install ECM's dependencies. |
| 15 | 1 | tash | |
| 16 | 1 | tash | |
| 17 | 1 | tash | h3. Python |
| 18 | 1 | tash | |
| 19 | 1 | tash | |
| 20 | 1 | tash | First you must install "Python 2.5 or later":http://www.python.org/download/releases/. |
| 21 | 1 | tash | |
| 22 | 1 | tash | We don't use Python 3.0 because Django doesn't support it. |
| 23 | 1 | tash | |
| 24 | 1 | tash | Do not forget to add the python to the path, if not already. |
| 25 | 1 | tash | |
| 26 | 1 | tash | |
| 27 | 1 | tash | h3. Setup Tools |
| 28 | 1 | tash | |
| 29 | 1 | tash | |
| 30 | 22 | diabeteman | Setup Tools is a python library that adds a @easy_install@ command to your system. @easy_install@ is a cool utility that allows you to install (almost) any python library/app with a simple command line. |
| 31 | 1 | tash | |
| 32 | 1 | tash | To install setuptools: http://pypi.python.org/pypi/setuptools |
| 33 | 1 | tash | |
| 34 | 6 | diabeteman | Note: On debian, @aptitude install python-setuptools@ will install it easily. |
| 35 | 1 | tash | |
| 36 | 22 | diabeteman | Check if @easy_install@ is in your system path. If not, you will find it in the @Scripts@ dir in your python installation folder. |
| 37 | 1 | tash | |
| 38 | 22 | diabeteman | h3. Optional: Mod WSGI |
| 39 | 1 | tash | |
| 40 | 10 | ajurna | |
| 41 | 22 | diabeteman | This is a very effective Apache mod for executing Python applications. |
| 42 | 1 | tash | |
| 43 | 22 | diabeteman | Here is the home site http://code.google.com/p/modwsgi/ |
| 44 | 1 | tash | |
| 45 | 22 | diabeteman | I recommend to install it through your OS's embedded package manager (e.g. apt-get or rpm) if you are on a linux distribution. Or to download the source package and compile it. |
| 46 | 1 | tash | |
| 47 | 22 | diabeteman | h3. Optional: gevent |
| 48 | 1 | tash | |
| 49 | 22 | diabeteman | See [[InstallationInstructions#Deployment alternatives]] |
| 50 | 1 | tash | |
| 51 | 1 | tash | |
| 52 | 1 | tash | |
| 53 | 22 | diabeteman | h2. Install ECM |
| 54 | 1 | tash | |
| 55 | 33 | diabeteman | h3. Runtime files |
| 56 | 33 | diabeteman | |
| 57 | 22 | diabeteman | ECM is available as a package in the Python Package Index. Simply run: |
| 58 | 1 | tash | |
| 59 | 22 | diabeteman | <pre> |
| 60 | 34 | diabeteman | $ easy_install -O2 ecm |
| 61 | 22 | diabeteman | </pre> |
| 62 | 1 | tash | |
| 63 | 34 | diabeteman | It will download and install all python dependencies of ECM and ECM itself (the @-O2@ is to tell python to compile optimized byte code). |
| 64 | 1 | tash | |
| 65 | 1 | tash | Once this is done, you will have a @ecm-admin@ tool installed. Check if it is in your path and continue. |
| 66 | 1 | tash | |
| 67 | 33 | diabeteman | h3. Prepare the database |
| 68 | 1 | tash | |
| 69 | 33 | diabeteman | |
| 70 | 32 | diabeteman | You first need to create a database for the instance along with a user that has the rights to do anything in it (create tables, etc.). |
| 71 | 20 | ajurna | |
| 72 | 32 | diabeteman | Note: "SQLite":http://www.sqlite.org/ is great for local tests but it is *not suitable for a production usage*. I personally recommend "PostgreSQL":http://www.postgresql.org/ which is *much more reliable* than "MySQL":http://www.mysql.com/, especially for database schema migrations. Also, make sure you have the python database driver corresponding to your database engine. You can find more information "here":https://docs.djangoproject.com/en/1.4/ref/databases/. |
| 73 | 1 | tash | |
| 74 | 32 | diabeteman | */!\ IMPORTANT /!\ MySQL storage engine:* ECM uses database transactions that only work with InnoDB tablespaces (see #129). You need to configure your server to "enable InnoDB by default":http://dev.mysql.com/doc/refman/5.1/en/storage-engine-setting.html. |
| 75 | 32 | diabeteman | |
| 76 | 32 | diabeteman | <pre><code>[mysqld] |
| 77 | 32 | diabeteman | default-storage-engine = InnoDB |
| 78 | 1 | tash | </code></pre> |
| 79 | 32 | diabeteman | |
| 80 | 33 | diabeteman | h3. Create an ECM instance |
| 81 | 32 | diabeteman | |
| 82 | 32 | diabeteman | Once this is OK, you can go and create your instance. I would recommend to create it in a standard location (eg @/var/www@). Here is an example of running the @ecm-admin create@ function: |
| 83 | 32 | diabeteman | |
| 84 | 18 | ajurna | <pre> |
| 85 | 32 | diabeteman | root@localhost:~# ecm-admin create /var/www/ecm-instance |
| 86 | 1 | tash | [ECM] Database engine? {oracle|sqlite|postgresql|mysql} [default=sqlite] mysql |
| 87 | 32 | diabeteman | [ECM] Database name? [default=ecm] ecm |
| 88 | 32 | diabeteman | [ECM] Database user? [default=ecm] ecm |
| 89 | 32 | diabeteman | [ECM] Database password? [default=ecm] mysecretpassword |
| 90 | 20 | ajurna | [ECM] External host name? ecm.corpurl.com |
| 91 | 1 | tash | [ECM] Email of the server administrator? (for error notifications) admin@corpurl.com |
| 92 | 32 | diabeteman | [ECM] Email used as "from" address in emails sent by the server? noreply@corpurl.com |
| 93 | 1 | tash | [ECM] Embedded server listening address? [default=127.0.0.1] |
| 94 | 1 | tash | [ECM] Embedded server listening port? [default=8888] |
| 95 | 20 | ajurna | [ECM] |
| 96 | 32 | diabeteman | [ECM] New ECM instance created in "/var/www/ecm-instance". |
| 97 | 32 | diabeteman | [ECM] Please check the configuration in "/var/www/ecm-instance/settings.ini" before running `ecm-admin init "/var/www/ecm-instance"`. |
| 98 | 18 | ajurna | </pre> |
| 99 | 22 | diabeteman | |
| 100 | 35 | diabeteman | */!\ listening port /!\* If you install multiple instances on the same computer and use the embedded server, make sure you assign *different ports to each one of them*. If you don't, you won't be able to run them. If you run in *Apache httpd* with *mod_wsgi* you can ignore this. |
| 101 | 32 | diabeteman | |
| 102 | 32 | diabeteman | after that you need to run the @init@ function. @ecm-admin init "/var/www/ecm-instance"@ |
| 103 | 32 | diabeteman | |
| 104 | 18 | ajurna | <pre> |
| 105 | 32 | diabeteman | root@localhost:~# ecm-admin init /var/www/ecm-instance |
| 106 | 18 | ajurna | ... |
| 107 | 1 | tash | [ECM] done |
| 108 | 1 | tash | </pre> |
| 109 | 1 | tash | |
| 110 | 22 | diabeteman | Note: you can pass all installation options directly on the command-line to avoid annoying prompts. All the arguments can be listed by typing: @ecm-admin create -h or --help@ |
| 111 | 20 | ajurna | |
| 112 | 1 | tash | <pre> |
| 113 | 32 | diabeteman | root@localhost:~# ecm-admin help create |
| 114 | 1 | tash | Usage: ecm-admin create [OPTIONS] instance_dir |
| 115 | 1 | tash | |
| 116 | 1 | tash | Options: |
| 117 | 4 | diabeteman | -h, --help show this help message and exit |
| 118 | 1 | tash | -q, --quiet Do not prompt user (use default values). |
| 119 | 1 | tash | |
| 120 | 21 | ajurna | Database options: |
| 121 | 21 | ajurna | --db-engine=DB_ENGINE |
| 122 | 1 | tash | DB engine ['oracle', 'sqlite', 'postgresql', 'mysql'] |
| 123 | 1 | tash | --db-name=DB_NAME Database name |
| 124 | 21 | ajurna | --db-user=DB_USER Database user |
| 125 | 1 | tash | --db-password=DB_PASS |
| 126 | 1 | tash | Database user password |
| 127 | 21 | ajurna | |
| 128 | 21 | ajurna | Web & Mail options: |
| 129 | 21 | ajurna | --host-name=HOST_NAME |
| 130 | 21 | ajurna | The public name of ECM host computer. |
| 131 | 21 | ajurna | --admin-email=ADMIN_EMAIL |
| 132 | 21 | ajurna | Email of the server administrator (for error |
| 133 | 1 | tash | notifications) |
| 134 | 1 | tash | --server-email=SERVER_EMAIL |
| 135 | 21 | ajurna | Email used as "from" address in emails sent by the |
| 136 | 21 | ajurna | server. |
| 137 | 21 | ajurna | |
| 138 | 1 | tash | Server options: |
| 139 | 1 | tash | --bind-address=BIND_ADDRESS |
| 140 | 1 | tash | Server listening address |
| 141 | 1 | tash | --bind-port=BIND_PORT |
| 142 | 1 | tash | Server listening address |
| 143 | 1 | tash | --run-as-user=RUN_AS_USER |
| 144 | 1 | tash | User that will be running the server |
| 145 | 1 | tash | --pid-file=PID_FILE |
| 146 | 1 | tash | File where to store the PID of the server process. |
| 147 | 1 | tash | </pre> |
| 148 | 1 | tash | |
| 149 | 42 | diabeteman | |
| 150 | 42 | diabeteman | |
| 151 | 42 | diabeteman | h3. Configure Apache httpd |
| 152 | 42 | diabeteman | |
| 153 | 42 | diabeteman | */!\ Important /!\* if you want to run ECM outside the Apache httpd process, please read [[InstallationInstructions#Deployment-alternatives|the deployment alternatives]]. |
| 154 | 42 | diabeteman | |
| 155 | 42 | diabeteman | Next thing you need to do is modify your apache configuration. Include the @/var/www/ecm-instance/examples/apache_mod_wsgi_vhost.example@ file to your Apache configuration. |
| 156 | 42 | diabeteman | |
| 157 | 42 | diabeteman | *Explanation:* ECM is developed for Django and is written in Python. Django as an application server serves the dynamic and Apache as an web server the static content(like pictures, javascript, ...). Since Apache "can't deal" with python by default, you need to *make sure you have apache_mod_wsgi installed and running*, to make everything work. (The fact ECM starts doesn't mean the content get's served properly or even at all). |
| 158 | 42 | diabeteman | |
| 159 | 42 | diabeteman | Once *mod_wsgi* is running, you have to point apache to the static content of your ecm instance, so it knows what static content to serve. This is the step of creating the symbolic link refers to. |
| 160 | 42 | diabeteman | |
| 161 | 42 | diabeteman | Depending on the Linux flavour you are running, you can usually find the folder to configure apache under: |
| 162 | 42 | diabeteman | |
| 163 | 42 | diabeteman | <pre> |
| 164 | 42 | diabeteman | /etc/apache2 |
| 165 | 42 | diabeteman | </pre> |
| 166 | 42 | diabeteman | |
| 167 | 42 | diabeteman | So in the case of debian i would do something like this: |
| 168 | 42 | diabeteman | |
| 169 | 42 | diabeteman | <pre> |
| 170 | 42 | diabeteman | root@debian:/etc/apache2/sites-enabled# ln -s /var/www/<instance-folder>/examples/apache_mod_wsgi_vhost.example 001-my-ecm-instance |
| 171 | 42 | diabeteman | </pre> |
| 172 | 42 | diabeteman | |
| 173 | 42 | diabeteman | Note: the folder under debian is /etc/apache2/sites-enabled, in which the symbolic link is created. |
| 174 | 42 | diabeteman | |
| 175 | 42 | diabeteman | "That should do the trick". |
| 176 | 42 | diabeteman | |
| 177 | 42 | diabeteman | Besides slightly different ways to configure apache for most flavours of linux, it is important to note, that if you are running on a shared host, above steps might not apply at all or some directives in the vhost configuration created with your instace may not be available. In this case you will have to check with your hoster how to perform the apache configuration. In most cases you might find step-by-step guides from your hoster or on the web. |
| 178 | 42 | diabeteman | |
| 179 | 42 | diabeteman | |
| 180 | 42 | diabeteman | *Important:* you should make sure that the user that is running apache (usually www-data) has the permission to write in the installation directory (and all its sub directories). If not, ECM will crash at startup. You can do that with the following command: |
| 181 | 42 | diabeteman | |
| 182 | 42 | diabeteman | <pre> |
| 183 | 42 | diabeteman | ~# chown -R www-data <install_dir> |
| 184 | 42 | diabeteman | </pre> |
| 185 | 42 | diabeteman | |
| 186 | 42 | diabeteman | And restart Apache httpd. |
| 187 | 42 | diabeteman | |
| 188 | 42 | diabeteman | |
| 189 | 42 | diabeteman | |
| 190 | 42 | diabeteman | |
| 191 | 42 | diabeteman | |
| 192 | 21 | ajurna | h3. Startup the application |
| 193 | 21 | ajurna | |
| 194 | 21 | ajurna | |
| 195 | 42 | diabeteman | * First you have to start/restart/reload Apache httpd (and maybe start your instance's dedicated WSGI server if you went for [[InstallationInstructions#Deployment-alternatives|deployment alternatives]]). |
| 196 | 42 | diabeteman | * Access the server at the URL you configured during the installation with the user _admin_ password _adminecm_ (change the password as soon as possible!!!) |
| 197 | 1 | tash | * When you log in you will be prompted to provide a corp api key. please provide a full corp key to access all features and future features. but you can limit it if you want. |
| 198 | 39 | diabeteman | * After the api key has been entered, ecm will run all updates to pull info from the web api. |
| 199 | 15 | ajurna | |
| 200 | 1 | tash | h3. Setup the cron job |
| 201 | 1 | tash | |
| 202 | 1 | tash | |
| 203 | 1 | tash | In order to enable ECM auto-update, you need to setup a cron job that will invoke a specific command on a regular basis. |
| 204 | 1 | tash | |
| 205 | 1 | tash | Edit your crontab with @crontab -e@ and add this line: |
| 206 | 1 | tash | <pre> |
| 207 | 1 | tash | */5 * * * * /usr/local/bin/ecm-admin manage <full path to ecm instance> update --cron --silent |
| 208 | 1 | tash | </pre> |
| 209 | 1 | tash | |
| 210 | 1 | tash | NB: You will find log files in the @<instance_dir>/logs@ folder. |
| 211 | 1 | tash | |
| 212 | 42 | diabeteman | |
| 213 | 42 | diabeteman | |
| 214 | 42 | diabeteman | |
| 215 | 42 | diabeteman | |
| 216 | 42 | diabeteman | |
| 217 | 42 | diabeteman | |
| 218 | 33 | diabeteman | h1. How to upgrade an existing installation? |
| 219 | 33 | diabeteman | |
| 220 | 42 | diabeteman | |
| 221 | 42 | diabeteman | |
| 222 | 42 | diabeteman | |
| 223 | 24 | diabeteman | h2. Upgrade from a 2.x installation |
| 224 | 24 | diabeteman | |
| 225 | 24 | diabeteman | Update ECM runtime with this command: |
| 226 | 24 | diabeteman | |
| 227 | 24 | diabeteman | <pre> |
| 228 | 34 | diabeteman | $ easy_install -U -O2 ecm |
| 229 | 24 | diabeteman | </pre> |
| 230 | 24 | diabeteman | |
| 231 | 24 | diabeteman | Then you will need to upgrade your instance(s) with @ecm-admin upgrade@: |
| 232 | 24 | diabeteman | |
| 233 | 24 | diabeteman | <pre> |
| 234 | 24 | diabeteman | $ ecm-admin upgrade <your instance directory> |
| 235 | 24 | diabeteman | </pre> |
| 236 | 24 | diabeteman | |
| 237 | 24 | diabeteman | There are some options on the @upgrade@ subcommand that you can see with @ecm-admin help upgrade@: |
| 238 | 24 | diabeteman | |
| 239 | 24 | diabeteman | <pre> |
| 240 | 24 | diabeteman | $ ecm-admin help upgrade |
| 241 | 24 | diabeteman | Usage: ecm-admin upgrade [OPTIONS] instance_dir |
| 242 | 24 | diabeteman | |
| 243 | 24 | diabeteman | Options: |
| 244 | 24 | diabeteman | -h, --help show this help message and exit |
| 245 | 24 | diabeteman | --no-syncdb Do not modify the instance's database. |
| 246 | 24 | diabeteman | -u, --upgrade-from-1.4.9 |
| 247 | 24 | diabeteman | Upgrade from ECM-1.4.9. |
| 248 | 24 | diabeteman | --eve-db-url=EVE_DB_URL |
| 249 | 24 | diabeteman | URL where to download EVE database archive. |
| 250 | 24 | diabeteman | --eve-db-zip-archive=EVE_ZIP_ARCHIVE |
| 251 | 24 | diabeteman | Local path to EVE database archive (skips download). |
| 252 | 24 | diabeteman | --skip-eve-db-download |
| 253 | 24 | diabeteman | Do NOT download EVE db (use with care). |
| 254 | 24 | diabeteman | --from-ccp-dump Update EVE database from CCP official dump (can take a |
| 255 | 24 | diabeteman | long time). |
| 256 | 24 | diabeteman | --ccp-dump-url=CCP_DUMP_URL |
| 257 | 24 | diabeteman | URL where to download CCP official dump. |
| 258 | 24 | diabeteman | --ccp-dump-archive=CCP_DUMP_ARCHIVE |
| 259 | 24 | diabeteman | Local archive of CCP official dump (skips download). |
| 260 | 24 | diabeteman | -s, --symlink-files Create symbolic links instead of copying static files. |
| 261 | 24 | diabeteman | </pre> |
| 262 | 24 | diabeteman | |
| 263 | 24 | diabeteman | |
| 264 | 27 | diabeteman | |
| 265 | 27 | diabeteman | |
| 266 | 27 | diabeteman | h2. Upgrade from a 1.4.9 installation |
| 267 | 24 | diabeteman | |
| 268 | 24 | diabeteman | *Important: if you have a pre 1.4.9 installation, please upgrade it to 1.4.9 before applying this migration. It has good chances to fail if you don't.* |
| 269 | 24 | diabeteman | |
| 270 | 24 | diabeteman | If you are a 1.4.9 user you will need to follow these steps to upgrade your installation to 2.0: |
| 271 | 24 | diabeteman | |
| 272 | 24 | diabeteman | h3. First of all: BACK-YOUR-SHIT-UP! |
| 273 | 24 | diabeteman | |
| 274 | 24 | diabeteman | You will be sorry if you didn't. Here's how to do it in a database agnostic way. Go in your ecm-1.4.9 installation dir and run the following commands: |
| 275 | 24 | diabeteman | |
| 276 | 33 | diabeteman | <pre> |
| 277 | 33 | diabeteman | $ ./manage.py dumpdata auth.User auth.Group common corp roles scheduler assets accounting > ~/ecm_dump-1.4.9.json |
| 278 | 25 | diabeteman | </pre> |
| 279 | 24 | diabeteman | |
| 280 | 24 | diabeteman | This json file contains all your data from 1.4.9 that can be restored (in case of problem) with |
| 281 | 24 | diabeteman | |
| 282 | 24 | diabeteman | <pre> |
| 283 | 24 | diabeteman | $ ./manage.py loaddata ~/ecm_dump-1.4.9.json |
| 284 | 24 | diabeteman | </pre> |
| 285 | 24 | diabeteman | |
| 286 | 24 | diabeteman | */!\ IMPORTANT /!\ MySQL storage engine:* ECM uses database transactions that only work with InnoDB tablespaces (see #129). You need to configure your server to "enable InnoDB by default":http://dev.mysql.com/doc/refman/5.1/en/storage-engine-setting.html. |
| 287 | 24 | diabeteman | |
| 288 | 24 | diabeteman | <pre><code>[mysqld] |
| 289 | 24 | diabeteman | default-storage-engine = InnoDB |
| 290 | 24 | diabeteman | </code></pre> |
| 291 | 24 | diabeteman | |
| 292 | 24 | diabeteman | If your tables are MyISAM and you want to keep your data, you will need to "convert them to InnoDB":http://dev.mysql.com/doc/refman/5.0/en/converting-tables-to-innodb.html. |
| 293 | 24 | diabeteman | |
| 294 | 24 | diabeteman | h3. Do the migration |
| 295 | 24 | diabeteman | |
| 296 | 24 | diabeteman | Once your data has been backuped, you can install ECM runtime files: |
| 297 | 24 | diabeteman | |
| 298 | 1 | tash | <pre> |
| 299 | 43 | diabeteman | # easy_install -U -O2 ecm |
| 300 | 24 | diabeteman | </pre> |
| 301 | 24 | diabeteman | |
| 302 | 24 | diabeteman | Then create an instance with ecm-admin: |
| 303 | 24 | diabeteman | |
| 304 | 25 | diabeteman | <pre> |
| 305 | 25 | diabeteman | # ecm-admin create /var/www/ecm-instance |
| 306 | 24 | diabeteman | [ECM] Database engine? {oracle|sqlite|postgresql|mysql} [default=sqlite] <your database server> |
| 307 | 24 | diabeteman | [ECM] Database name? [default=ecm] <1.4.9 database name> |
| 308 | 24 | diabeteman | [ECM] Database user? [default=ecm] <1.4.9 database user> |
| 309 | 41 | tash | [ECM] Database password? [default=ecm] <1.4.9 database password> |
| 310 | 41 | tash | [ECM] External host name? ecm.corpurl.com |
| 311 | 41 | tash | [ECM] Email of the server administrator? (for error notifications) admin@corpurl.com |
| 312 | 41 | tash | [ECM] Email used as "from" address in emails sent by the server? noreply.corpurl.com |
| 313 | 41 | tash | [ECM] Embedded server listening address? [default=127.0.0.1] |
| 314 | 41 | tash | [ECM] Embedded server listening port? [default=8888] |
| 315 | 41 | tash | [ECM] |
| 316 | 41 | tash | [ECM] New ECM instance created in "/var/www/ecm-instance". |
| 317 | 41 | tash | [ECM] Please check the configuration in "/var/www/ecm-instance/settings.ini" before running `ecm-admin init "/var/www/ecm-instance"`. |
| 318 | 41 | tash | </pre> |
| 319 | 41 | tash | |
| 320 | 41 | tash | Ignore the message saying that you should run @ecm-admin init@ and run: |
| 321 | 41 | tash | |
| 322 | 41 | tash | <pre> |
| 323 | 41 | tash | # ecm-admin upgrade --from-1.4.9 /var/www/ecm-instance |
| 324 | 24 | diabeteman | </pre> |
| 325 | 24 | diabeteman | |
| 326 | 29 | diabeteman | If this runs without errors, you've successfully migrated your installation to 2.0. |
| 327 | 1 | tash | |
| 328 | 1 | tash | h1. Deployment alternatives |
| 329 | 1 | tash | |
| 330 | 1 | tash | |
| 331 | 1 | tash | The idea is to run all python code into a dedicated python WSGI application container, and serve all static files with a standard HTTP server. |
| 332 | 1 | tash | |
| 333 | 1 | tash | |
| 334 | 1 | tash | h2. WSGI servers |
| 335 | 1 | tash | |
| 336 | 28 | diabeteman | I found an "interesting article":http://nichol.as/benchmark-of-python-web-servers presenting a benchmark of several python WSGI servers allowing to do that. I will give some examples here: |
| 337 | 1 | tash | |
| 338 | 38 | diabeteman | h3. Install gevent |
| 339 | 1 | tash | |
| 340 | 37 | diabeteman | You can install *gevent* with @easy_install@: |
| 341 | 28 | diabeteman | |
| 342 | 1 | tash | <pre> |
| 343 | 34 | diabeteman | ~# easy_install -U -O2 gevent |
| 344 | 1 | tash | Downloading/unpacking gevent |
| 345 | 1 | tash | Running setup.py egg_info for package gevent |
| 346 | 1 | tash | Downloading/unpacking greenlet (from gevent) |
| 347 | 1 | tash | Running setup.py egg_info for package greenlet |
| 348 | 1 | tash | Installing collected packages: gevent, greenlet |
| 349 | 1 | tash | Running setup.py install for gevent |
| 350 | 1 | tash | building 'gevent.core' extension |
| 351 | 1 | tash | gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c gevent/core.c -o build/temp.linux-i686-2.5/gevent/core.o |
| 352 | 1 | tash | gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/gevent/core.o -levent -o build/lib.linux-i686-2.5/gevent/core.so |
| 353 | 1 | tash | Linking /root/build/gevent/build/lib.linux-i686-2.5/gevent/core.so to /root/build/gevent/gevent/core.so |
| 354 | 1 | tash | Running setup.py install for greenlet |
| 355 | 1 | tash | building 'greenlet' extension |
| 356 | 1 | tash | gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c greenlet.c -o build/temp.linux-i686-2.5/greenlet.o |
| 357 | 1 | tash | gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.5/greenlet.o -o build/lib.linux-i686-2.5/greenlet.so |
| 358 | 1 | tash | Linking /root/build/greenlet/build/lib.linux-i686-2.5/greenlet.so to /root/build/greenlet/greenlet.so |
| 359 | 1 | tash | Successfully installed gevent greenlet |
| 360 | 1 | tash | Cleaning up... |
| 361 | 1 | tash | </pre> |
| 362 | 1 | tash | |
| 363 | 1 | tash | Once *gevent* is installed, you can use ecm-admin daemon with these commands: |
| 364 | 1 | tash | |
| 365 | 1 | tash | <pre> |
| 366 | 1 | tash | ~# ecm-admin start <instance directory> |
| 367 | 1 | tash | ~# ecm-admin stop <instance directory> |
| 368 | 1 | tash | ~# ecm-admin status <instance directory> |
| 369 | 1 | tash | </pre> |
| 370 | 1 | tash | |
| 371 | 1 | tash | or simply run the server in the current shell: |
| 372 | 1 | tash | |
| 373 | 1 | tash | <pre> |
| 374 | 1 | tash | ~# ecm-admin run <instance directory> |
| 375 | 1 | tash | </pre> |
| 376 | 37 | diabeteman | |
| 377 | 37 | diabeteman | h3. Compile gevent |
| 378 | 37 | diabeteman | |
| 379 | 37 | diabeteman | If @easy_install gevent@ failed it means that you miss some dependencies. It needs to be compiled as it is a C extension so you will need python C headers. |
| 380 | 37 | diabeteman | |
| 381 | 37 | diabeteman | Example on debian linux: |
| 382 | 37 | diabeteman | |
| 383 | 37 | diabeteman | <pre> |
| 384 | 37 | diabeteman | ~# aptitude install python-dev |
| 385 | 37 | diabeteman | Reading package lists... Done |
| 386 | 37 | diabeteman | Building dependency tree |
| 387 | 37 | diabeteman | Reading state information... Done |
| 388 | 37 | diabeteman | ... |
| 389 | 37 | diabeteman | </pre> |
| 390 | 37 | diabeteman | |
| 391 | 37 | diabeteman | Also, you will need *libevent* headers (version 1.4.2 or later is required by *gevent*): |
| 392 | 37 | diabeteman | |
| 393 | 37 | diabeteman | <pre> |
| 394 | 37 | diabeteman | ~# aptitude install libevent-1.4.2 libevent-dev |
| 395 | 37 | diabeteman | Reading package lists... Done |
| 396 | 37 | diabeteman | Building dependency tree |
| 397 | 37 | diabeteman | Reading state information... Done |
| 398 | 37 | diabeteman | Reading extended state information |
| 399 | 37 | diabeteman | Initializing package states... Done |
| 400 | 37 | diabeteman | The following NEW packages will be installed: |
| 401 | 37 | diabeteman | libevent-dev |
| 402 | 37 | diabeteman | 0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded. |
| 403 | 37 | diabeteman | .... |
| 404 | 37 | diabeteman | </pre> |
| 405 | 37 | diabeteman | |
| 406 | 37 | diabeteman | @easy_install gevent@ should work now :cuir: |
| 407 | 1 | tash | |
| 408 | 1 | tash | h3. On Windows |
| 409 | 1 | tash | |
| 410 | 1 | tash | If you don't feel like compiling all that on Windows (which could be a pain in the %$@#), just use *gevent* and *greenlet* precompiled python libraries that you'll find here: |
| 411 | 1 | tash | |
| 412 | 1 | tash | * http://www.lfd.uci.edu/~gohlke/pythonlibs/#gevent |
| 413 | 28 | diabeteman | * http://www.lfd.uci.edu/~gohlke/pythonlibs/#greenlet |
| 414 | 1 | tash | |
| 415 | 28 | diabeteman | You can now run ecm with its embedded gevent WSGI server with a simple command: |
| 416 | 28 | diabeteman | |
| 417 | 28 | diabeteman | <pre> |
| 418 | 1 | tash | C:\> ecm-admin run <path to your ecm instance> |
| 419 | 1 | tash | </pre> |
| 420 | 1 | tash | |
| 421 | 1 | tash | |
| 422 | 1 | tash | h2. Setup the reverse proxy |
| 423 | 28 | diabeteman | |
| 424 | 1 | tash | |
| 425 | 1 | tash | Once the WSGI application server is running, you can set-up the reverse proxy that will serve static files and relay all non-static requests to your WSGI server. This is important that the python WSGI server does not serve static files it will imply unnecessary load on it. |
| 426 | 1 | tash | |
| 427 | 1 | tash | |
| 428 | 1 | tash | h3. Apache HTTPD |
| 429 | 28 | diabeteman | |
| 430 | 1 | tash | |
| 431 | 28 | diabeteman | You will find an example virtual host config in your instance directory under @examples@ (*mod_proxy* and *mod_proxy_http* need to be enabled): |
| 432 | 1 | tash | |
| 433 | 1 | tash | <pre> |
| 434 | 1 | tash | # vim: set filetype=apache: |
| 435 | 28 | diabeteman | <VirtualHost *:80> |
| 436 | 28 | diabeteman | |
| 437 | 1 | tash | DocumentRoot "/var/www/ecm-instance" |
| 438 | 28 | diabeteman | ServerName "ecm.yourcorp.url" |
| 439 | 28 | diabeteman | |
| 440 | 28 | diabeteman | <Proxy *> |
| 441 | 28 | diabeteman | Order deny,allow |
| 442 | 1 | tash | Allow from all |
| 443 | 28 | diabeteman | </Proxy> |
| 444 | 28 | diabeteman | |
| 445 | 1 | tash | ProxyPass /static/ ! |
| 446 | 28 | diabeteman | ProxyPass / http://127.0.0.1:8888/ |
| 447 | 28 | diabeteman | |
| 448 | 28 | diabeteman | <Directory "/var/www/ecm-instance/static"> |
| 449 | 28 | diabeteman | Order deny,allow |
| 450 | 28 | diabeteman | Allow from all |
| 451 | 1 | tash | Options -Indexes |
| 452 | 1 | tash | </Directory> |
| 453 | 28 | diabeteman | |
| 454 | 1 | tash | </VirtualHost> |
| 455 | 1 | tash | </pre> |