Skip to content

Commit

Permalink
docs: Update deployment to use pyenv
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jun 26, 2024
1 parent 3924d57 commit d01e677
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ There's also a package to provide colourful district map tiles:

The following instructions are to setup your own instance of Represent. If you just want access to data, [please read our API documentation](https://represent.opennorth.ca/api/).

Follow the instructions in the [Python Quick Start Guide](https://github.com/opennorth/wiki/wiki/Python-Quick-Start%3A-OS-X) to install Homebrew, Git, Python, virtualenv, GDAL and PostGIS. The [deployment](deployment/) uses Python 3.5, PostgreSQL 9.6, and PostGIS 2.3.
Follow the instructions in the [Python Quick Start Guide](https://github.com/opennorth/wiki/wiki/Python-Quick-Start%3A-OS-X) to install Homebrew, Git, Python, virtualenv, GDAL and PostGIS. The [deployment](deployment/) uses Python 3.9, PostgreSQL 9.6, and PostGIS 2.3.

Create a database and enable PostGIS (commands should be issued as user `postgres`):

Expand All @@ -27,10 +27,10 @@ Create a database and enable PostGIS (commands should be issued as user `postgre

Install the project:

pyvenv represent-env
source represent-env/bin/activate
git clone https://github.com/opennorth/represent-canada.git
cd represent-canada
pyenv virtualenv 3.9.19 represent
pyenv activate represent
git clone https://github.com/opennorth/represent-canada.git app
cd app
pip install -r requirements.txt

Configure the `DATABASES` Django setting and and create the database tables:
Expand Down
2 changes: 1 addition & 1 deletion deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `represent` user's directory contains:
* `ssl/`: public key certificates
* a clone of [represent-canada-data](https://github.com/opennorth/represent-canada-data/)
* a clone of `represent-canada-private-data`
* `represent-env/`: a Python 3.5 virtualenv
* `.pyenv/versions/represent/`: a Python 3.9 virtualenv

The `represent` user's crontab contains:

Expand Down
2 changes: 1 addition & 1 deletion deployment/crontab
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# m h dom mon dow command
MAILTO=[email protected]
0 4 * * * /home/represent/represent-env/bin/python /home/represent/app/manage.py updaterepresentatives
0 4 * * * /home/represent/.pyenv/versions/represent/bin/python /home/represent/app/manage.py updaterepresentatives
2 changes: 1 addition & 1 deletion deployment/represent.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ After=network.target
User=represent
Group=represent
WorkingDirectory=/home/represent/app
ExecStart=/home/represent/represent-env/bin/gunicorn -c /home/represent/gunicorn_settings.py represent.wsgi:application
ExecStart=/home/represent/.pyenv/versions/represent/bin/gunicorn -c /home/represent/gunicorn_settings.py represent.wsgi:application
PIDFile=/home/op/gunicorn.pid
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
Expand Down
2 changes: 1 addition & 1 deletion fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tempeh():

def _env_init():
env.home_dir = '/home/' + env.user
env.python = os.path.join(env.home_dir, 'represent-env', 'bin', 'python')
env.python = os.path.join(env.home_dir, '.pyenv', 'versions', 'represent', 'bin', 'python')
env.base_dir = os.path.join(env.home_dir)
env.django_dir = os.path.join(env.base_dir, 'app')
env.pip = env.python.replace('bin/python', 'bin/pip')
Expand Down

0 comments on commit d01e677

Please sign in to comment.