Apartment rental listing platform to match realtors with potential home renters and buyers.
Services:
- https://dashboard.stripe.com/account/team
- https://app.mailgun.com/app/account/settings
- https://dash.cloudflare.com/413ad3842c5a82a780b582d8de8dc903/zalad.io/dns
- https://console.cloud.google.com/google/maps-apis/overview?pli=1&project=pennybags-1556050514027
Clone this repo into the /opt
directory:
# Use ssh (not https) to avoid push permission errors
# (replace YOUR_GITHUB_USER with your github username)
git clone git@github.com:YOUR_GITHUB_USER/pennybags.git /opt/monadical.homenet
If you clone it elsewhere instead (e.g. inside your home folder), you must symlink /opt/monadical.homenet
to the repo location:
ln -s /path/to/cloned/repo/pennybags /opt/monadical.homenet
ln -s /opt/monadical.homenet /opt/pennybags
If you use Bash, add these lines to your ~/.bashrc
or ~/.bash_profile
file:
PATH=./node_modules/.bin:./.venv/bin:./../.venv/bin:$PATH
PIPENV_VENV_IN_PROJECT=1
PIPENV_IGNORE_VIRTUALENVS=1
If you use Fish, add these lines to your ~/.config/fish/config.fish
file:
set -x PATH ./node_modules/.bin ./.venv/bin ./../.venv/bin $PATH
set -x PIPENV_VENV_IN_PROJECT 1
set -x PIPENV_IGNORE_VIRTUALENVS 1
sudo apt install python3.7 python3-pip python3.7-dev libpango1.0-0 # or `brew install python3 pango`
Optional: You can also use pyenv to install python3.7 if you have trouble installing it with apt
or brew
.
Install the pipenv
package manager
python3.7 -m pip install pipenv
(The Python dependencies are defined in ./Pipfile
)
cd /opt/monadical.homenet
pipenv install --dev
pipenv clean
pipenv lock --clear
pipenv check
On Ubuntu:
sudo apt install npm gdal-bin
On Mac:
brew install node gdal
Install the yarn
package manager
npm install --global npm
npm install --upgrade --global yarn
(The JS dependencies are defined in ./pennydjango/js/package.json
)
cd /opt/monadical.homenet/pennydjango/js
yarn install
Add this line to your /etc/hosts
file (sudo
is required to edit it):
127.0.0.1 homenet.l
Supervisord is used to manage starting and stopping nginx, postgresql, and any other background services.
On Ubuntu:
sudo apt install supervisor
systemctl enable supervisor
On Mac:
brew install supervisor
brew services start supervisor
On Ubuntu:
sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt install postgresql libpq-dev
# Postgresl is managed by supervisord, so we dont want it being started at boot
systemctl stop postgresql
systemctl disable postgresql
On macOS:
brew install postgresql
brew link --overwrite --force postgresql
# Postgresl is managed by supervisord, so we dont want it being started at boot
brew services stop postgresql
cd /opt/monadical.homenet
# instantiate a new postgresql db data dir
initdb data/database
# Create role, db, and grant privileges
pg_ctl -D data/database start
psql -c "CREATE USER penny WITH PASSWORD 'penny';" postgres
psql -c "CREATE DATABASE penny OWNER penny;" postgres
psql -c "GRANT ALL PRIVILEGES ON DATABASE penny TO penny;" postgres
psql -c "ALTER USER penny CREATEDB;" postgres
pg_ctl -D data/database stop
cd /opt/monadical.homenet
# Run the initial db migrations
pg_ctl -D data/database start
./.venv/bin/python ./pennydjango/manage.py migrate
pg_ctl -D data/database stop
On Ubuntu:
sudo add-apt-repository -y ppa:nginx/stable
sudo apt update
sudo apt install nginx
systemctl stop nginx
systemctl disable nginx
On macOS:
brew install nginx
brew services stop nginx
cd /opt/monadical.homenet
./bin/generate_dev_ssl homenet.l openssl
./bin/generate_dev_ssl homenet.zalad.io openssl
# optionally specify mkcert arg instead of openssl if its installed
# https://github.com/FiloSottile/mkcert
Background processes are managed by Supervisord, they must be started in order for Django to work.
First, link the supervisord config to your system supervisord config folder.
On Ubuntu:
ln -s /opt/monadical.homenet/etc/supervisor/monadical.homenet.dev.ubuntu.conf /etc/supervisor/conf.d/
On macOS:
mkdir /usr/local/etc/supervisor.d
ln -s /opt/monadical.homenet/etc/supervisor/monadical.homenet.dev.ubuntu.conf /usr/local/etc/supervisor.d/
Then start supervisord and confirm the background tasks have been started succesfully.
supervisorctl reread
supervisorctl update
supervisorctl status
Should output something like:
monadical.homenet:nginx RUNNING pid 28518, uptime 0:25:32
monadical.homenet:django RUNNING pid 28517, uptime 0:25:32
monadical.homenet:postgres RUNNING pid 28516, uptime 0:25:32
If you encounter any problems, you can check the logs here:
/opt/monadical.homenet/data/logs/*.log
cd /opt/monadical.homenet
# activate the virtualenv
pipenv shell
# or source .venb/bin/activate (in bash)
# or source .venv/bin/activate.fish (in fish)
# Start the django runserver
./manage.py runserver
✅ Then open https://homenet.l in your browser.
Alternatively, open http://127.0.0.1:8000 to access runserver directly without using nginx (always use nginx if possible though).
cd /opt/monadical.homenet
source .venv/bin/activate
# or `source .venv/bin/activate.fish`
# or `pipenv shell`
cd /opt/monadical.homenet
# make sure supervisord is running first
systemctl start supervisor # on mac: brew services start supervisor
# then check the status of all services or a specific service
supervisorctl status <service|all>
supervisorctl stop <service|all>
supervisorctl start <service|all>
cd /opt/monadical.homenet/data/logs
tail -f nginx.err
tail -f nginx.out
tail -f postgres.log
tail -f reloads.log
tail -f django.log
# etc.
# first make sure postgresql is running with supervisord
cd /opt/monadical.homenet/pennydjango
# activate virtualenv (see above)
./manage.py migrate
python3 --version # should be >= 3.7.3, check inside virtualenv too
pipenv --version # should be >= 2018.11.26
node --version # should be >= 12.6.0
npm --version # should be >= 6.10.2
yarn --version # should be >= 1.17.3
supervisord --version # should be >= 3.3.5
postgres --version # should be >= 10.0
nginx --version # should be >= 1.15.12
which <binary> # e.g. `which nginx` or `which python3`
Clear the yarn cache and try again.
yarn cache clean
yarn install
Clear the pipenv cache and try again.
pipenv lock --clear
pipenv clean
pipenv install