該項目是在耶魯數字人文實驗室的前階段開發的。現在是耶魯圖書館的計算方法和數據部門的一部分,該實驗室不再包括該項目的工作範圍。因此,它將不會收到進一步的更新。本網站的當前版本(在此不反映)由Elihu Rubin教授擁有。
繪製紐黑文的建築歷史。
紐黑文建築檔案館(NHBA)是紐黑文建築物的數字檔案。該存儲庫包含該網站的源代碼和指南,以在本地或EC2實例上構建該站點。

此應用程序需要Node.js(6或更高版本)和MongoDB。
該應用程序中的數據遷移需要pymongo( pip install pymongo )。
要在計算機上運行此應用程序,請打開終端並運行:
# obtain application source and enter repository
git clone https://github.com/duhaime/nhba
cd nhba
# load database
wget https://s3-us-west-2.amazonaws.com/lab-apps/nhba/archives/nhba-11-12-08.archive -O nhba.archive
mongo nhba --eval "db.dropDatabase()"
mongorestore --db nhba --archive=nhba.archive
# obtain images
wget https://s3-us-west-2.amazonaws.com/lab-apps/nhba/archives/build.tar.gz -O build.tar.gz
tar -zxf build.tar.gz
# install nvm, e.g. with brew
brew install nvm
# install node compatible with this library
nvm install v10.24.1
nvm use v10.24.1
# install dependencies
npm install --no-optional
# start production server
npm run production
然後,該應用程序將在localhost:8080上可用。
您可以選擇打開另一個終端窗口,CD到NHBA目錄中,然後運行npm run start以在8081上啟動開發服務器。此開發服務器取決於生產服務器,但具有熱模塊重新加載,以更快地開發速度。
要在EC2上的Amazon Linux實例上部署此應用程序,必須:
# Install Node.js on Amazon Linux
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 6.10.0
node -v
# Install MongoDB on Amazon Linux
sudo touch /etc/yum.repos.d/mongodb-org-3.4.repo
sudo vim /etc/yum.repos.d/mongodb-org-3.4.repo
# paste the following:
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
sudo yum install -y mongodb-org
sudo service mongod start
sudo chkconfig mongod on
讓我們加密允許用戶獲得綁定域地址的免費SSL證書。要運行Let's Encrypt Client並獲得證書,您必須為EC2實例創建彈性IP,獲取域名(例如Cats.com)並將您的EC2實例綁定到域。對於使用Namecheap的用戶,這篇文章提供了詳盡的指南。
完成此操作後,可以使用以下命令下載並運行Let's Encrypt Client:
# get Let's Encrypt client
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
# pass domain to -d; must be a bound domain, not a raw IP
sudo ./certbot-auto --debug -v --server https://acme-v01.api.letsencrypt.org/directory certonly -d YOURDOMAIN.EXT
在此處,您的domain.ext指的是您的實例綁定的域。提示時,選擇第二個選項(臨時服務器)來處理您的證書。
然後更新nhba/config.js文件以反映證書的位置。默認位置為/etc/letsencrypt/live/YOURDOMAIN.EXT/fullchain.pem
要在HTTPS上運行您的應用程序,只需更新nhba/config.js :
config.api = {
protocol: 'https',
host: 'YOURDOMAIN.EXT',
port: 443,
prefix: 'api'
}
將以下變量添加到~/.bash_profile :
export NHBA_EMAIL='YOURGMAILACCOUNT' # e.g. catparty
export NHBA_EMAIL_PASSWORD='YOURGMAILPASSWORD' # e.g. meow
export NHBA_SECRET='NHBA_SECRET' # equivalent to `rake secret`
export NHBA_SALT_WORK_FACTOR=10 # encryption difficulty
export NHBA_ENVIRONMENT='production' # switch to production
export NHBA_ADMIN_EMAILS='[email protected] [email protected]' # space separated emails
export NHBA_SUPERADMIN_EMAILS='[email protected]' # space separated emails
然後source ~/.bash_profile
創建一個可以保留用戶上傳的目錄:MKDIR構建/資產/上傳/文件
只有SuperAdmin用戶才能任命其他管理用戶。 SuperAdmin用戶必須在命令行級別任命:
# enter nhba db
mongo nhba
# find a user by their email address and make them a superadmin
db.users.update({'email': '[email protected]'}, {$set: {'superadmin': true}})
npm run compress
sudo node server.js
您可能希望使用Forever.js這樣的包裝器來保持服務器的運行...