Deploy Office 365 AddIns on Linux

Mai 18, 2021

How to deploy your own JavaScript Office 365 AddInn Instance on Linux:

Development enviroment: 

  • Visual Studio Code: https://code.visualstudio.com/
  • Addons: ESLint, TSLint, HTML CSS Support
  • curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt install nodejs
  • npm install -g yo generator-office
  • yo office

Adjust ports for hosting (bash script)

#!/bin/bash

# Assign the filename
filename_port="./package.json"
filename_ip="./manifest.xml"
search_ip="localhost:3000"
search_port="3000"

# Take the search string
read -p "Port eingeben: " replace_port

# Take the replace string
read -p "<IP:Port> eingeben " replace_ip

echo "Gibt es Port schon?"
netstat -ano | grep :$replace_port

if [[ $search_ip != "" && $replace_ip != "" ]]; then
sed -i "s/$search_ip/$replace_ip/" $filename_ip
fi

if [[ $search_port != "" && $replace_port != "" ]]; then
sed -i "s/$search_port/$replace_port/" $filename_port
fi

Deployment on Linux (Node)

IMPORTANT: the declared ports in package.json should be available

netstat -ano | grep :<port in package.json:12>

  • npm install office-addin-dev-certs
  • npm install
  • npm start

Port forwarding (get public access)

socat tcp-listen: "$port_extern"",reuseaddr,fork tcp:localhost:"$port_intern" 

port_intern: Port that you specified with the bash script (Port in package.json)

port_extern: Port over which public access should take place

View all node instances
ps -fC node
Kill all instances
killall node