2.0 Update to the Pantheon Site
- Install node dependencies
> npm install
- Make entry for pantheon-api in hosts file
> nano /etc/hosts
10.1.10.129 pantheon-api.local
- Run site
> npm run dev
- Install postgresql && postgrest via Homebrew
# Ensure brew is up to date
> brew update
# Check for any problems with brew's setup
> brew doctor
# Install the postgrest package
> brew install postgresql gmp postgrest
- Initialize the DB
> createdb pantheon
- Copy data to local DB
> cat pantheon_db_dump_MM-DD-YYYY.sql | psql pantheon
- Run postgrest and point to local copy of DB
> postgrest postgres://[username]:@localhost:5432/pantheon -a [username] --schema public -p 3100
- Initialize the DB
> createdb pantheon
- Create tables via DB schema file
> psql pantheon < data/pantheon_schema.sql
- Run data ETL process (warning: need the following python libs)
> python data/import_to_db.py
- Add dates of sovereignty
> python data/import_soverign_dates_to_db.py
- Run post data insert SQL commands
> psql pantheon < data/post_insert_updates.sql
- Import page creation data
> python data/import_creation_to_db.py
- Fix duplicate place & person name slugs
> python data/fix_duplicate_slugs.py
Currently the images folder is ~300mb so it doesn't make sense to host them here. I will put instructions on how to download them or maybe setup a CDN to host them soon.
To make the hot reloading of CSS work, we are not extracting CSS in development. Ideally, during server rendering, we will be extracting CSS, and we will get a .css file, and we can use it in the html template. That's what we are doing in production.
In development, after all scripts get loaded, react loads the CSS as BLOBs. That's why there is a second of FOUC in development.
This warning is visible only on development and totally harmless. This occurs to hash difference in react-router
. To solve it, react router docs asks you to use match
function. If we use match
, react-hot-reloader
stops working.
Pantheon makes use of the electron-screenshot-service module, which requires that xvfb along with a few helper packages be installed system wide on the ubuntu server.
sudo apt-get install -y xorg libgtk2.0-0 libgconf-2-4 libasound2 libxtst6 libxss1 libnss3 xvfb
Additional image processing is done by the sharp
nodejs package which requires make and g++, so installing the build-essential
apt package is necessary:
sudo apt-get install build-essential