Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3netxer/9fc85c7d13af3005c228dc2737e00aef to your computer and use it in GitHub Desktop.
Save d3netxer/9fc85c7d13af3005c228dc2737e00aef to your computer and use it in GitHub Desktop.
Add let´s enrypt to geonode
# - Close port 8080 for inbound networking
# - Edit your local_settings to use proxy /geonode (and not port 8080)
# - Add following to local_settings: AVATAR_GRAVATAR_SSL = True
# - make sure mod_ssl is active: $ a2enmod ssl
# add let´s encrypt repository
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
# install certbot
$ sudo apt-get install python-certbot-apache
# add cert
# - this will create certs and geonode-le-ssl.conf ! see comment 1 below
# - Further it will configure a cron job to regenerate certs before 90 days limit
# - (for multiple domains use $ sudo certbot --apache -d example.com -d www.example.com)
# - if your certs coming from another authority or you´d like to force ssh see comment 2
$ sudo certbot --apache -d example.com
# export database
$ pg_dump -U geonode -d geonode > /tmp/geonode.sql
# replace old http urls
$ sed -i 's,http://example.com,https://example.com,g' /tmp/geonode.sql
# rename geonode database
$ sudo -u postgres psql -c "ALTER DATABASE geonode RENAME TO geonode_bak"
# create tmp database
$ sudo -u postgres createdb -O geonode geonode
# restore dump
$ sudo -u postgres psql -d geonode -f /tmp/geonode.sql
# if all is fine drop geonode_bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment