Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MYFQDN=''
MYCLIENTID='client'
MYCLIENTSECRET='secret'
MYAPI='api'
sudo apt-get update
sudo apt-get install -y curl git python-pycurl python-pip python-yaml python-paramiko python-jinja2 postgresql-9.5 python-software-properties software-properties-common
sudo -u postgres -i -- sh -c 'createuser -R -P -S -D fhir;createdb -O fhir fhir'
sudo apt-get install nginx
mkdir /etc/nginx/apps-enabled
rm -f /etc/nginx/sites-enabled/default
echo "
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
error_log /var/log/proxy.error.log;
access_log /var/log/proxy.access.log;
include /etc/nginx/apps-enabled/*;
}" >> /etc/nginx/sites-enabled/frontend
service nginx reload
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java7-installer
mkdir /fhir
cd /fhir
git clone https://github.com/smart-on-fhir/api-server
cd api-server
echo "
# JAVA
JAVA_HOME='/usr/lib/jvm/java-7-oracle'
# FHIR
BASE_URL='https://$MYFQDN/$MYAPI'
AUTH=false
TOKEN_CACHE_SPEC='maximumSize=1000,expireAfterWrite=30m'
INTROSPECTION_URI='http://$MYFQDN/auth/introspect?token={token}'
AUTH_CLIENT_ID='$MYCLIENTID'
AUTH_CLIENT_SECRET='$MYCLIENTSECRET'
REGISTER_URI='http://$MYFQDN/auth/register'
AUTHORIZE_URI='http://$MYFQDN/auth/authorize'
TOKEN_URI='http://$MYFQDN/auth/token'
CLIENT_ID='$MYCLIENTID'
CLIENT_SECRET='$MYCLIENTSECRET'" >> /etc/environment
echo '
location /$MYAPI/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:8080/;
}
' >> /etc/nginx/apps-enabled/smart-fhir
service nginx reload
source /etc/environment
echo "./grailsw run-app &" > /fhir/api-server/start.sh
chmod 700 /fhir/api-server/start.sh
export JAVA_HOME
cd /fhir/api-server
./start.sh &
cd /fhir
git clone --recursive https://github.com/smart-on-fhir/sample-patients
cd sample-patients/bin
python generate.py --write-fhir ../generated-data
python generate.py --summary > ../generated-data/summary.txt
cd ../generated-data
for i in *.xml; do curl 'http://localhost:8080/?' -H 'Content-Type: text/xml' --data-binary @$i; done
Owner

ChrisCompton commented Jul 11, 2016

A walkthrough of commands to se up the SMART on FHIR api-server.

cerniuk commented Jul 15, 2016

Well done on the documentation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment