FishPass - Web Frontend Interface for OptiPass
Create a project Directory
Clone marineplanner-core into it
Load Fishpass into MP core:
cd marineplanner-core/apps
git clone https://github.com/Ecotrust/FishPass.git
Configure app
vagrant up
vagrant provision
to restart the provisioning process without losing all progressvagrant reload
after installation to restart the server so all updates are appliedlog in to the server with vagrant ssh
Set your Local Settings
Import your data
dj loaddata /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/fixtures/initial_setup.json
dj import_focus_areas ZIPFILE TYPE
where:
ZIPFILE
is a zipped shapefile in 3857TYPE
is on of the approved Focus Area types (see fishpass/project_settings.py FOCUS_AREA_TYPES
)dj import_focus_areas /usr/local/apps/marineplanner-core/apps/FishPass/layers/counties.zip County
Enable Anonymous User
See steps below for installing OptiPass
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git
mkdir /usr/local/apps
sudo chgrp adm /usr/local/apps
cd /usr/local/apps
git clone https://github.com/Ecotrust/marineplanner-core.git
cd /usr/local/apps/marineplanner-core/scripts/
sudo chmod +x vagrant_provision0.sh
sudo vagrant_provision0.sh bionic 3.7.0 10
#Ubuntu Bionic, GEOS 3.7.0, PostgreSQL 10cd /usr/local/apps/marineplanner-core/apps
git clone https://github.com/Ecotrust/FishPass.git
cd FishPass/scripts
chmod +x configure_project.sh
cp configure_project.sh /usr/local/apps/marineplanner-core/scripts/configure_project.sh
cd /usr/local/apps/marineplanner-core/scripts/
./configure_project.sh fishpass
cd /usr/local/apps/marineplanner-core/apps/FishPass/
./vagrant_provision.sh marineplanner-core marineplanner marineplanner /usr/local/apps/marineplanner-core/apps/FishPass/fishpass
/usr/local/apps/marineplanner-core/apps/mp-accounts/scripts/vagrant_provision.sh marineplanner-core
/usr/local/apps/marineplanner-core/apps/mp-visualize/scripts/vagrant_provision.sh marineplanner-core
/usr/local/apps/marineplanner-core/apps/madrona-scenarios/scripts/vagrant_provision.sh marineplanner-core
Activate the virtualenvironment and install the dependencies:
source /usr/local/apps/marineplanner-core/env/bin/activate
pip install -e /usr/local/apps/marineplanner-core/apps/madrona-manipulators/
pip install -e /usr/local/apps/marineplanner-core/apps/madrona-scenarios/
pip install -r /usr/local/apps/marineplanner-core/apps/madrona-scenarios/requirements.txt
pip install -e /usr/local/apps/marineplanner-core/apps/mp-accounts/
pip install -r /usr/local/apps/marineplanner-core/apps/mp-accounts/requirements.txt
pip install -e /usr/local/apps/marineplanner-core/apps/mp-data-manager/
pip install -e /usr/local/apps/marineplanner-core/apps/mp-drawing/
pip install -r /usr/local/apps/marineplanner-core/apps/mp-drawing/requirements.txt
pip install -e /usr/local/apps/marineplanner-core/apps/p97-nursery/
pip install -r /usr/local/apps/marineplanner-core/apps/p97-nursery/requirements.txt
pip install -e /usr/local/apps/marineplanner-core/apps/madrona-analysistools/
Finish the process
/usr/local/apps/marineplanner-core/scripts/vagrant_finish_provision.sh marineplanner-core marineplanner
Create Shortcut 'dj':
sudo vim /etc/bash.bashrc
alias dj="/usr/local/apps/marineplanner-core/env/bin/python /usr/local/apps/marineplanner-core/marineplanner/manage.py"
alias djrun="dj runserver 0:8000"
Load Data:
dj loaddata /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/fixtures/initial_setup.json
sudo chmod +x /usr/local/apps/marineplanner-core/apps/FishPass/OptiPass/OptiPassMain.out
sudo chmod 777 /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/media
dj import_focus_areas /usr/local/apps/marineplanner-core/apps/FishPass/layers/counties.zip County
sudo apt-get install rabbitmq-server
cd /usr/local/apps/marineplanner-core/marineplanner/marineplanner
ln -s /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/celery.py ./celery.py
cat /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/__init__.py >> __init__.py
via http://docs.celeryproject.org/en/latest/userguide/daemonizing.html#usage-systemd
sudo su root
ln -s /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/deploy/celery.service /etc/systemd/system/celery.service
mkdir /etc/conf.d
ln -s /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/deploy/celery /etc/conf.d/celery
adduser celery
mkdir /var/log/celery
chown celery:celery /var/log/celery
systemctl start celery.service
sudo chown celery:www-data /usr/local/apps/marineplanner-core/apps/FishPass/fishpass/media/reports
sudo systemctl enable celery
sudo systemctl daemon-reload
NOTE: Double-check that you have media served by nginx (like static)
ln -s /usr/local/apps/marineplanner-core/apps/FishPass/scripts/configure_production.sh /usr/local/apps/marineplanner-core/scripts/
cd /usr/local/apps/marineplanner-core/scripts/
sudo chmod +x configure_production.sh
./configure_production.sh
sudo apt-get install nginx uwsgi uwsgi-plugin-python3 -y
pip install uwsgi
sudo cp /usr/local/apps/marineplanner-core/deployment/marineplanner_nginx.conf /etc/nginx/sites-available/marineplanner
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/marineplanner /etc/nginx/sites-enabled/marineplanner
sudo cp /usr/local/apps/marineplanner-core/deployment/uwsgi_params /etc/nginx/
sudo cp /usr/local/apps/marineplanner-core/deployment/emperor.ini /etc/uwsgi/
sudo ln -s /usr/local/apps/marineplanner-core/deployment/uwsgi.service /etc/systemd/system/
sudo ln -s /usr/local/apps/marineplanner-core/deployment/marineplanner.ini /etc/uwsgi/apps-enabled/
sudo chmod +x /usr/local/apps/marineplanner-core/deployment/restart_nginx.sh
sudo service uwsgi start
sudo service uwsgi restart
sudo cp /usr/local/apps/marineplanner-core/deployment/rc.local /etc/rc.local
rc.local does not run by default on 18.04. You need to tell it to run on boot using systemd and systemctl. I recommend this tutorail
sudo apt-get install postfix
configuration:
Internet Site
System mail name :
enter the domain name you plan to use, i.e.: fishpass.psmfc.org
Then set Django settings to look something like this:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'FISHPass<fishpass@your.domain>'
Configure DNS for secure delivery (see internal documentation)
NOTE: This does not seem required for the signup popup, only if user finds /account/
sudo apt-get install munin munin-node
sudo vim /etc/nginx/sites-enabled/marineplanner
Between the error_log
line and the location /static
line add:
location /munin/static/ {
alias /etc/munin/static/;
}
location /munin {
alias /var/cache/munin/www;
}
Then restart NGINX
sudo service nginx restart
From the document Using the "unattended-upgrades" package
Install the unattended-upgrades package if it isn't already installed:
sudo apt-get install unattended-upgrades
To enable it, do:
sudo dpkg-reconfigure --priority=low unattended-upgrades
(it's an interactive dialog) which will create /etc/apt/apt.conf.d/20auto-upgrades
with the following contents:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
To have the server automatically reboot when necessary to install security upddates:
update-notifier-common
sudo apt-get install update-notifier-common
/etc/apt/apt.conf.d/50unattended-upgrades
near the bottom you will find the line
//Unattended-Upgrade::Automatic-Reboot "false";
uncomment it and set value to true:
Unattended-Upgrade::Automatic-Reboot "true";
To tell the server what time is most safe to reboot (when needed), uncomment the line
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
And set the time to your desired restart time.
Read the source document for more details.