|
25 | 25 | task('python:venv:create', static function () { |
26 | 26 | run('mkdir -p .hypernode'); |
27 | 27 | run('virtualenv -p python3 .venv'); |
| 28 | + run('echo export PYTHONPATH=$(pwd) >> .venv/bin/activate'); |
28 | 29 | }); |
29 | 30 |
|
30 | 31 | # Install the requirements |
31 | 32 | task('python:venv:requirements', static function () { |
32 | 33 | run('source .venv/bin/activate && pip install -r requirements/base.txt'); |
33 | 34 | }); |
34 | 35 |
|
| 36 | +task('python:generate_redirects', static function () { |
| 37 | + run('mkdir -p etc/nginx'); |
| 38 | + run('source .venv/bin/activate && bin/generate_nginx_redirects > etc/nginx/server.redirects.conf'); |
| 39 | +}); |
| 40 | + |
35 | 41 | # Build the documentation |
36 | 42 | task('python:build_documentation', static function () { |
37 | 43 | run('source .venv/bin/activate && bin/build_docs'); |
|
49 | 55 | } |
50 | 56 | }); |
51 | 57 |
|
52 | | -task("deploy:docs_vhost", static function () { |
53 | | - run("hypernode-manage-vhosts --https --force-https {{hostname}} --no --webroot {{current_path}}/{{public_folder}}"); |
| 58 | +task('deploy:docs_vhost:acceptance', static function () { |
| 59 | + run('hypernode-manage-vhosts --https --force-https {{hostname}} --no --webroot {{current_path}}/{{public_folder}}'); |
| 60 | +})->select('stage=acceptance'); |
| 61 | + |
| 62 | +task('deploy:docs_vhost:production', static function () { |
| 63 | + run('hypernode-manage-vhosts --https --force-https docs.hypernode.io --no --webroot {{current_path}}/{{public_folder}}'); |
| 64 | +})->select('stage=production'); |
| 65 | + |
| 66 | +task('deploy:nginx_redirects', static function () { |
| 67 | + run('cp {{release_path}}/etc/nginx/server.redirects.conf /data/web/nginx/server.redirects.conf'); |
54 | 68 | }); |
55 | 69 |
|
56 | 70 | $configuration = new Configuration(); |
57 | 71 | $configuration->addBuildTask('python:venv:create'); |
58 | 72 | $configuration->addBuildTask('python:venv:requirements'); |
59 | 73 | $configuration->addBuildTask('python:build_documentation'); |
| 74 | +$configuration->addBuildTask('python:generate_redirects'); |
60 | 75 | $configuration->addDeployTask('deploy:disable_public'); |
61 | 76 | $configuration->addDeployTask('deploy:hmv_docker'); |
62 | | -$configuration->addDeployTask('deploy:docs_vhost'); |
| 77 | +$configuration->addDeployTask('deploy:docs_vhost:acceptance'); |
| 78 | +$configuration->addDeployTask('deploy:docs_vhost:production'); |
| 79 | +$configuration->addDeployTask('deploy:nginx_redirects'); |
63 | 80 |
|
64 | 81 | # Just some sane defaults to exclude from the deploy |
65 | 82 | $configuration->setDeployExclude([ |
|
73 | 90 | '.idea', |
74 | 91 | '.gitignore', |
75 | 92 | '.editorconfig', |
76 | | - 'etc/', |
77 | | - '.venv/', |
78 | | - 'bin/', |
79 | | - 'hypernode/', |
80 | | - 'requirements/', |
81 | | - 'tests/' |
| 93 | + './.venv/', |
| 94 | + './bin/', |
| 95 | + './hypernode/', |
| 96 | + './requirements/', |
| 97 | + './tests/', |
82 | 98 | ]); |
83 | 99 |
|
84 | 100 | $productionStage = $configuration->addStage('production', 'docs.hypernode.io'); |
|
0 commit comments