Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync from templates #96

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions 10.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/oryx/node:10.1-20190730.1
FROM mcr.microsoft.com/oryx/node:10.1-20191018.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

RUN echo "ipv6" >> /etc/modules
Expand All @@ -8,8 +8,18 @@ RUN npm install -g pm2 \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

&& apt-get install --yes --no-install-recommends \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
openrc \
yarn \
net-tools \
dnsutils \
tcpdump \
iproute2
# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
Expand All @@ -24,6 +34,7 @@ RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& echo "cd /home" >> /root/.bashrc \
&& cd /opt/startup \
&& npm install

Expand Down
6 changes: 3 additions & 3 deletions 10.1/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]; then
if [[ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]; then
elif [[ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
if [ -f "oryx-manifest.toml" ] && [[ "$APPSVC_RUN_ZIP" == "TRUE" ]]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
Expand Down
17 changes: 14 additions & 3 deletions 10.10/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/oryx/node:10.10-20190730.1
FROM mcr.microsoft.com/oryx/node:10.10-20191018.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

RUN echo "ipv6" >> /etc/modules
Expand All @@ -8,8 +8,18 @@ RUN npm install -g pm2 \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

&& apt-get install --yes --no-install-recommends \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
openrc \
yarn \
net-tools \
dnsutils \
tcpdump \
iproute2
# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
Expand All @@ -24,6 +34,7 @@ RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& echo "cd /home" >> /root/.bashrc \
&& cd /opt/startup \
&& npm install

Expand Down
6 changes: 3 additions & 3 deletions 10.10/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]; then
if [[ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]; then
elif [[ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
if [ -f "oryx-manifest.toml" ] && [[ "$APPSVC_RUN_ZIP" == "TRUE" ]]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
Expand Down
17 changes: 14 additions & 3 deletions 10.12/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/oryx/node:10.12-20190730.1
FROM mcr.microsoft.com/oryx/node:10.12-20191018.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

RUN echo "ipv6" >> /etc/modules
Expand All @@ -8,8 +8,18 @@ RUN npm install -g pm2 \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

&& apt-get install --yes --no-install-recommends \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
openrc \
yarn \
net-tools \
dnsutils \
tcpdump \
iproute2
# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
Expand All @@ -24,6 +34,7 @@ RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& echo "cd /home" >> /root/.bashrc \
&& cd /opt/startup \
&& npm install

Expand Down
6 changes: 3 additions & 3 deletions 10.12/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]; then
if [[ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]; then
elif [[ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
if [ -f "oryx-manifest.toml" ] && [[ "$APPSVC_RUN_ZIP" == "TRUE" ]]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
Expand Down
17 changes: 14 additions & 3 deletions 10.14/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/oryx/node:10.14-20190730.1
FROM mcr.microsoft.com/oryx/node:10.14-20191018.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

RUN echo "ipv6" >> /etc/modules
Expand All @@ -8,8 +8,18 @@ RUN npm install -g pm2 \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt-get update \
&& apt-get install --yes --no-install-recommends openssh-server vim curl wget tcptraceroute openrc

&& apt-get install --yes --no-install-recommends \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
openrc \
yarn \
net-tools \
dnsutils \
tcpdump \
iproute2
# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
Expand All @@ -24,6 +34,7 @@ RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& echo "cd /home" >> /root/.bashrc \
&& cd /opt/startup \
&& npm install

Expand Down
6 changes: 3 additions & 3 deletions 10.14/startup/init_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]; then
if [[ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]; then
elif [[ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [ "$APPSVC_RUN_ZIP" = "TRUE" ]; then
if [ -f "oryx-manifest.toml" ] && [[ "$APPSVC_RUN_ZIP" == "TRUE" ]]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
Expand Down
53 changes: 53 additions & 0 deletions 10.16/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM mcr.microsoft.com/oryx/node:10.16-20191018.1
LABEL maintainer="Azure App Services Container Images <[email protected]>"

RUN echo "ipv6" >> /etc/modules

RUN npm install -g pm2 \
&& mkdir -p /home/LogFiles /opt/startup \
&& echo "root:Docker!" | chpasswd \
&& echo "cd /home" >> /etc/bash.bashrc \
&& apt-get update \
&& apt-get install --yes --no-install-recommends \
openssh-server \
vim \
curl \
wget \
tcptraceroute \
openrc \
yarn \
net-tools \
dnsutils \
tcpdump \
iproute2
# setup default site
RUN rm -f /etc/ssh/sshd_config
COPY startup /opt/startup
COPY hostingstart.html /opt/startup

# configure startup
RUN mkdir -p /tmp
COPY sshd_config /etc/ssh/

COPY ssh_setup.sh /tmp
RUN chmod -R +x /opt/startup \
&& chmod -R +x /tmp/ssh_setup.sh \
&& (sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null) \
&& rm -rf /tmp/* \
&& echo "cd /home" >> /root/.bashrc \
&& cd /opt/startup \
&& npm install

ENV PORT 8080
ENV SSH_PORT 2222
EXPOSE 2222 8080

ENV PM2HOME /pm2home

ENV WEBSITE_ROLE_INSTANCE_ID localRoleInstance
ENV WEBSITE_INSTANCE_ID localInstance
ENV PATH ${PATH}:/home/site/wwwroot

WORKDIR /home/site/wwwroot

ENTRYPOINT ["/opt/startup/init_container.sh"]
1 change: 1 addition & 0 deletions 10.16/hostingstart.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv=X-UA-Compatible content="IE=edge"><title>Microsoft Azure App Service - Welcome</title> <link rel="SHORTCUT ICON" href="https://c.s-microsoft.com/favicon.ico?v2" type="image/x-icon"/><link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/4.1.1/css/bootstrap.min.css" crossorigin="anonymous"><link rel="stylesheet" type="text/css" href="https://appservice.azureedge.net/css/linux-landing-page/v3/main.css"><script type="text/javascript">window.onload=function(){try{var a=window.location.hostname;if(a.includes(".azurewebsites.net")){a=a.replace(".azurewebsites.net", "")}var b=document.getElementById("depCenterLink");b.setAttribute("href", b.getAttribute("href") + "&sitename=" + a);}catch(d){}}</script></head><body><nav class="navbar navbar-light bg-light"><a class="navbar-brand " href="#"><div class="container pl-4 ml-5"> <img src="https://appservice.azureedge.net/images/linux-landing-page/v3/microsoft_azure_logo.png" width="270" height="108" alt=""> </div></a></nav><div class="container-fluid container-height mr-2"><div class="pt-10 pb-10 mt-10 mb-10 d-xxs-none d-xs-none d-sm-none d-md-none d-lg-block d-xl-block" style="height:20px; width:100%; clear:both;"></div><div class="row"><div class="row col-xs-12 col-sm-12 d-block d-lg-none d-xl-none d-md-block d-sm-block d-xs-block"><div class="text-center"> <img src="https://appservice.azureedge.net/images/linux-landing-page/v3/node.svg"> </div></div><div class=" extra-pl-small-scr offset-xl-1 offset-lg-1 offset-md-2 offset-sm-2 offset-xs-4 col-xl-5 col-lg-5 col-md-10 col-sm-11 col-xs-11 div-vertical-center"><div class="container-fluid"><div class="row"><h2>Hey, Node developers!</h2> </div><br><div class="row"><h4>Your app service is up and running.</h4> </div><div class="row"><h4>Time to take the next step and deploy your code.</h4> </div><div class="row info-mg-top"><p class=" pl-0 col-md-6 col-sm-12 info-mg-top"> Have your code ready?<br>Use deployment center to get code published from your client or setup continuous deployment.<br><a id='depCenterLink' href="https://go.microsoft.com/fwlink/?linkid=2057852"><button class="btn btn-primary btn-mg-top" type="submit">Deployment Center</button></a></p><p class="pl-0 offset-md-1 col-md-5 col-sm-12 info-mg-top">Don't have your code yet?<br>Follow our quickstart guide and you'll have a full app ready in 5 minutes or less.<br><button onclick="location.href='https://go.microsoft.com/fwlink/?linkid=2056941'" class="btn btn-primary btn-mg-top" type="submit">Quickstart</button></p></div></div></div><div class="col-xl-5 col-lg-5 col-md-12 d-none d-lg-block"><div class="text-center"> <img src="https://appservice.azureedge.net/images/linux-landing-page/v3/node.svg"> </div></div><div class="col-xl-1 col-lg-1 col-md-1"></div></div></div><!-- Bootstrap core JavaScript==================================================--><script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.2.1.min.js" crossorigin="anonymous"></script><script src="https://ajax.aspnetcdn.com/ajax/bootstrap/4.1.1/bootstrap.min.js" crossorigin="anonymous"></script></body></html>
26 changes: 26 additions & 0 deletions 10.16/ssh_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if [ ! -f "/etc/ssh/ssh_host_rsa_key" ]; then
# generate fresh rsa key
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
fi

if [ ! -f "/etc/ssh/ssh_host_dsa_key" ]; then
# generate fresh dsa key
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ecdsa_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t dsa
fi

if [ ! -f "/etc/ssh/ssh_host_ed25519_key" ]; then
# generate fresh ecdsa key
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t dsa
fi

#prepare run dir
if [ ! -d "/var/run/sshd" ]; then
mkdir -p /var/run/sshd
fi
16 changes: 16 additions & 0 deletions 10.16/sshd_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This is ssh server systemwide configuration file.
#
# /etc/sshd_config

Port SSH_PORT
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
7 changes: 7 additions & 0 deletions 10.16/startup/default-static-site.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var express = require('express');
var server = express();
var options = {
index: ['index.html','hostingstart.html']
};
server.use('/', express.static('/opt/startup', options));
server.listen(process.env.PORT);
50 changes: 50 additions & 0 deletions 10.16/startup/init_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
cat >/etc/motd <<EOL
_____
/ _ \ __________ _________ ____
/ /_\ \\___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X

Documentation: http://aka.ms/webapp-linux
NodeJS quickstart: https://aka.ms/node-qs
NodeJS Version : `node --version`

EOL
cat /etc/motd

mkdir "$PM2HOME"
chmod 777 "$PM2HOME"
ln -s /home/LogFiles "$PM2HOME"/logs

# Get environment variables to show up in SSH session
eval $(printenv | sed -n "s/^\([^=]\+\)=\(.*\)$/export \1=\2/p" | sed 's/"/\\\"/g' | sed '/=/s//="/' | sed 's/$/"/' >> /etc/profile)

# starting sshd process
sed -i "s/SSH_PORT/$SSH_PORT/g" /etc/ssh/sshd_config
/usr/sbin/sshd

STARTUP_COMMAND_PATH="/opt/startup/startup.sh"
ORYX_ARGS="-appPath /home/site/wwwroot -output $STARTUP_COMMAND_PATH -usePM2 -defaultApp=/opt/startup/default-static-site.js -userStartupCommand '$@'"

if [[ $APPSVC_REMOTE_DEBUGGING == "TRUE" ]]; then
ORYX_ARGS="-remoteDebug -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
elif [[ "$APPSVC_REMOTE_DEBUGGING_BREAK" == "TRUE" ]]; then
ORYX_ARGS="-remoteDebugBrk -debugPort $APPSVC_TUNNEL_PORT $ORYX_ARGS"
fi

if [ -f "oryx-manifest.toml" ] && [[ "$APPSVC_RUN_ZIP" == "TRUE" ]]; then
# NPM adds the current directory's node_modules/.bin folder to PATH before it runs, so commands in
# "npm start" can files there. Since we move node_modules, we have to add it to the path ourselves.
echo 'Fixing up path'
export PATH=/node_modules/.bin:$PATH
echo "$PATH"
fi

eval oryx $ORYX_ARGS

STARTUPCOMMAND=$(cat $STARTUP_COMMAND_PATH)
echo "Running $STARTUPCOMMAND"
$STARTUP_COMMAND_PATH
Loading