From dac00451820993181ae93506566ac4270e03afd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?=
Date: Sat, 25 Aug 2018 14:06:25 +0200
Subject: [PATCH] Make this elsable
Fixes https://github.com/pyvec/python.cz/issues/263
---
.gitignore | 4 +
.travis.yml | 15 ++--
README.md | 13 +---
deployment/README.md | 102 -------------------------
deployment/deploy.sh | 22 ------
deployment/id_rsa_pyvec_deployment.enc | Bin 3248 -> 0 bytes
deployment/update.sh | 28 -------
pythoncz/__init__.py | 4 +
pythoncz/templates/_base.html | 1 -
pythoncz/templates/meta_redirect.html | 19 +++++
pythoncz/views.py | 95 +++++++++++++++++++----
pythoncz_tests/views_test.py | 64 +++++-----------
runserver.py | 14 +---
setup.py | 2 +
14 files changed, 147 insertions(+), 236 deletions(-)
delete mode 100644 deployment/README.md
delete mode 100755 deployment/deploy.sh
delete mode 100644 deployment/id_rsa_pyvec_deployment.enc
delete mode 100755 deployment/update.sh
create mode 100644 pythoncz/templates/meta_redirect.html
diff --git a/.gitignore b/.gitignore
index e603a349..01d66724 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,7 @@ pip-log.txt
/cache/
.cache
.pytest_cache/
+
+# Elsa
+_build/
+/talks-archive/
diff --git a/.travis.yml b/.travis.yml
index d893682a..550f186a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,15 +6,20 @@ install:
- "pip install .[tests]"
script:
- "pytest"
+ - "test $TRAVIS_PULL_REQUEST == false || export DISABLE_GITHUB_ISSUES_FETCH=true"
+ - "python runserver.py freeze"
after_success:
- "coveralls"
deploy:
- provider: "script"
- script: "deployment/deploy.sh"
+ provider: script
+ skip_cleanup: true
+ script: 'python runserver.py deploy --no-freeze --push'
on:
- branch: "master"
- python: "3.4"
- repo: "pyvec/python.cz"
+ branch: master
+ repo: pyvec/python.cz
notifications:
slack:
secure: "s/PCU4+geUozmw3AJguPYpv/YFNZVYmQ30A3DZpbSOE/9HDEgqbaF/hONY1VhHriRBG1EJ2uSezbxjOveyJPV+UMGJFMPU4c4Mw4AHxyROSnJe/MpOKPd8QRgbtYWYwy5UI47bzxotGoN49Mk0EjqhaFk9DFb14et9YPwMDbrVY="
+env:
+ global:
+ secure: R1+KSJV1oOikNBvyil0m/FMace5Y4lVC8WTlIpspZZ30BDkJCQ0eTnXy7gFvuEa4wBmVSqRKnRm+LKf44wXRjyKy/KRwUIzuy9AmzzQMe/PuvWSQDz7zf1dvG7GlR0kTJlgJ7s0+Vh4uqEpjIQnvtn+xkLguYVs3QXmTUvxLMnA=
diff --git a/README.md b/README.md
index ddb42160..979a17a9 100644
--- a/README.md
+++ b/README.md
@@ -20,22 +20,17 @@ The site uses GitHub API. For certian pages to work correctly, you need to set t
```sh
$ export GITHUB_TOKEN=...
-$ python runserver.py
+$ python runserver.py --help
```
### Deployment
-The site gets automatically deployed after any push to the `master` branch. See [documentation in the `deployment` directory](deployment/README.md).
-
-- **Hosting:** [Rosti.cz](https://rosti.cz/)
- Access: [Pyvec](http://pyvec.org/)
+The site gets automatically deployed after any push to the `master` branch.
+It is frozen by [Elsa](https://github.com/pyvec/elsa). A cron job redeploys
+it daily, so any content of dynamic nature isn't outdated.
- **Domain:** bestowed by [KRAXNET](http://www.kraxnet.cz/)
Access: e-mail request to [KRAXNET](http://www.kraxnet.cz/)
-
-- **Monitoring:** [UptimeRobot](https://uptimerobot.com/)
- Access: [@honzajavorek](http://github.com/honzajavorek)
-
- **Analytics:** [Google Analytics](http://www.google.com/analytics/)
Access: [@honzajavorek](http://github.com/honzajavorek), [@encukou](http://github.com/encukou), [@martinbilek](http://github.com/martinbilek), [@benabraham](http://github.com/benabraham)
diff --git a/deployment/README.md b/deployment/README.md
deleted file mode 100644
index 1dfd0f96..00000000
--- a/deployment/README.md
+++ /dev/null
@@ -1,102 +0,0 @@
-
-# Deployment at [Rosti.cz](https://rosti.cz/)
-
-## Initial Setup
-
-- Register at [Rosti.cz](https://rosti.cz/), create an app with SSH access.
-- Clear default contents:
-
- ```
- $ rm -rf /srv/app
- ```
-
-- Clone the repository:
-
- ```
- $ git clone https://github.com/pyvec/python.cz /srv/app
- ```
-
-- Install:
-
- ```
- $ cd /srv/app
- $ pip install -r requirements.txt
- ```
-
-- Set `GITHUB_TOKEN` environment value. Get [GitHub Personal Access Token](https://github.com/settings/tokens) (with no scopes) and edit `/srv/conf/supervisor.d/python.conf`:
-
- ```
- [program:app]
- command=...
- environment=GITHUB_TOKEN="123a123dc..."
- ...
- ```
-
-- Restart [Supervisor](http://supervisord.org/):
-
- ```
- $ supervisorctl restart app
- ```
-
- The `app.py` file in the root of the project is used as WSGI endpoint.
-
-- The app should be up and running (e.g. [pythoncz-0375.rostiapp.cz](http://pythoncz-0375.rostiapp.cz/)).
-
-## Continuous Deployment
-
-Continuous deployment means your app gets automatically deployed if continuous integration (CI) build was successful. When turned on only for the `master` branch, the app gets deployed every time someone pushes to `master`, including merged GitHub Pull Requests.
-
-[Travis CI](http://travis-ci.org/) supports continuous deployment out of the box [for various PaaS services](http://docs.travis-ci.com/user/deployment/). [Rosti.cz](https://rosti.cz/) is not among them, but [it's possible to setup also your own deployment](http://docs.travis-ci.com/user/deployment/script/) using the `script` keyword.
-
-### Setup, step by step
-
-- Create an SSH key which is going to be used for deployment. Make sure it is *without passphrase* as you, obviously, won't be able to interactively type in the password at the end of your TravisCI builds.
-
- ```
- $ ssh-keygen -t rsa -b 4096 -C "info@pyvec.org"
- ...
- $ ssh-add ~/.ssh/id_rsa_pyvec_deployment
- ```
-
-- Upload the public key to the production server. First, you need to prepare the server so it has `authorized_keys` available - follow instructions from the [Rosti.cz documentation](https://docs.rosti.cz/base/#ssh). Then upload the public key:
-
- ```
- $ ssh-copy-id -i ~/.ssh/id_rsa_pyvec_deployment.pub app@pluto.rosti.cz -p 10365 # see Rosti.cz administration for username, host, port...
- ```
-
-- Encrypt the private key. See [documentation for encrypting files](http://docs.travis-ci.com/user/encrypting-files/). Please be aware that the encryption is repository-specific. Even if using the same private key for multiple projects, it needs to be re-encrypted individually for each of them.
-
- ```
- $ gem install travis
- $ travis login --auto
- $ travis encrypt-file id_rsa_pyvec_deployment
- ```
-
- Follow instructions of the `travis encrypt-file` output. You need to add decrypting command to your build. This repository has it in the `deployment/deploy.sh` script.
-
-- Make sure the deploy is going to happen. Update `.travis.yml` with custom deployment settings:
-
- ```yaml
- deploy:
- provider: "script"
- script: "deployment/deploy.sh"
- on:
- branch: "master"
- python: "3.4"
- repo: "pyvec/python.cz"
- ```
-
- This triggers `deploy.sh` script only for `master` branch with Python 3.4.
-
-- The `deploy.sh` script, executed within the TravisCI build, does three things:
-
- 1. Decrypts the private key (see above).
- 2. Connects to the production machine via SSH and executes the `update.sh` script.
- 3. Deletes the decrypted private key.
-
-- The `update.sh` script, executed on the production machine, does four things:
-
- 1. Deletes all source code of the current app.
- 2. Uses `git` to get the latest source code in the `master` branch.
- 3. Installs dependencies (plain simple `pip install -r requirements.txt`).
- 4. Restarts the app ([specific to Rosti.cz](https://docs.rosti.cz/apps/python/#supervisor)).
diff --git a/deployment/deploy.sh b/deployment/deploy.sh
deleted file mode 100755
index 8914ae8f..00000000
--- a/deployment/deploy.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-# Automatic TravisCI Deployment
-#
-# TravisCI runs this script in case the build on master branch was successful.
-# See repository README for details.
-
-
-# This script should be executed on the CI machine.
-if [ -z "$CI" ]; then
- exit
-fi
-
-# Decrypting private key
-openssl aes-256-cbc -K $encrypted_3814399f38ed_key -iv $encrypted_3814399f38ed_iv -in deployment/id_rsa_pyvec_deployment.enc -out deployment/id_rsa_pyvec_deployment -d
-chmod 600 deployment/id_rsa_pyvec_deployment
-
-# Run the 'update.sh' script remotely.
-ssh 'app@pluto.rosti.cz' -p '10365' -o 'StrictHostKeyChecking no' -i 'deployment/id_rsa_pyvec_deployment' '/srv/app/deployment/update.sh'
-
-# Remove decrypted private key
-rm deployment/id_rsa_pyvec_deployment
diff --git a/deployment/id_rsa_pyvec_deployment.enc b/deployment/id_rsa_pyvec_deployment.enc
deleted file mode 100644
index 8cf974246c6019e7667573e662c6c67d77b7cc2d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 3248
zcmV;h3{UgIND}7c!!)+Dc>op~EhtfWLcFwz<{Mcq&J8=fx7HTe7`JcUiY=xWY~9|L
zsWpx9a-?uJsAq@CxmHw5^EWOfju?hBDs<+JfB`AD6`LRYEf&
zACn&pU$hVJVxdp;3n&S>MGoJ)B@`<}DNZ$5>BW`I$jDc3&4OE@3FuW6rt_g}bW^>6{((^Xc
zCshs}hN#)~B%E_%l#V%1iAFOGuj&)k*f1y`kjsDrh)dPd0;TwB+)mJ8n2^OxgvB}K
z-4C;7EfO^j1C7JmJD6_N?5&Z;=QScLT9UGZ|5^gyhBnO$J^%2|xDlG7@Y(4Zxv}=D
zdfSM8E90g-MI61tpT}dS2Lu%yS9=1$7-RvfLafrI;4gSX2jR5(%5plXCCFXnN3l0E
zXIQBke%NC+9dG;1o&ecs+5QCe_A@PUGozZb#nB;S@8)m4WZ1{th79U)9u`$I$0%Ln
zVNZLfhl}$RC<|SvfZ;V;+l}(}(E9Q1W2(RZ0;2Q`m0y+Q7ktZ?lAfAhC-q$U$Gw3HXFzrcM9P94p#nZQ
zXLyrp`vpp{>oJY{n^ZjjJ(OeP618f!t^a#9H0k)Gav;gHs5FHeGV7=-xSJ
zt}>hPpoBZM05p#jdnUIU886BYNuCOj~V(@9SC*vny
z4)=`g^HZ~RjKnwG>Cm8U&?phGghXpfdhO0ExeT3gi5lMf%&@PY3SBfD@a5Cu-k=Op
z5MZmGxp;^`B+&4;{^;a&ghPi*m|q9_K*VFv)o$-CjUg$%U%5pTR3z{E7BW$dX+ANO
zfx`a(r-r}y5To=+A=`2rM?*&{Qnts~k&1Uq`(Qvw8WBIFm4HXD{%+pJQL<}JF?&Q_NsoRio
z{Agf>kj;QDH;3EPK9Q0)!7vu0ePB
z2*~$Cn+F4SYVyylOrN`N)GW2g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