- Download docker here: https://www.docker.com/get-started
- Once it is installed go to the project directory
- Run
docker build -t pdf-microservice .
This will build the docker image. - Run
docker images
and it will list the image you just built - Run
docker run -d -p ${PORT_YOU_WANT}:80 -i -t ${IMAGE_ID}
Now everything should be running and you can go to `localhost:${PORT_YOU_WANT}?url=https%3A%2F%2Fwww.google.com to interact with the api and get a pdf buffer of google's homepage
If you want to log into the docker container to do some bashjitsu:
- Run
docker ps
- Run
docker exec -it ${CONTAINER_ID} /bin/bash
- Profit! You are in bash.
- Run
apt-get update && apt-get install -y software-properties-common
- Run
curl -sL https://deb.nodesource.com/setup_12.x | bash -
- Run
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
- Run
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list
- Run
apt-get update && apt-get install -y gnupg apt-transport-https ca-certificates nodejs libapache2-mod-passenger google-chrome-stable
- Run
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
- Run
sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger buster main > /etc/apt/sources.list.d/passenger.list'
- Create file in
/etc/apache2/sites-available/pdf-microservices.conf
<VirtualHost *:80>
ServerName pdf.stage.api-microservices.ddm.io
# Tell Apache and Passenger where your app's code directory is
DocumentRoot /var/www/pdf-microservice/api
PassengerAppRoot /var/www/pdf-microservice/api
# Tell Passenger that your app is a Node.js app
PassengerAppType node
PassengerStartupFile index.js
# Relax Apache security settings
<Directory /var/www/pdf-microservice>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/pdf-microservice.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Run
a2enmod passenger
- Run
apache2ctl restart
- Run
/usr/bin/passenger-config validate-install
on passenger itself - Run
a2ensite pdf-microservices.conf
- Make sure that the subdomain can get traffic.