-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Single image implementation #215
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
Changes from all commits
2eeb822
b0dfd13
144a1c8
3460ffd
4a4bb64
97ed637
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=BGP container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Database container | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
start() { | ||
docker inspect --type container {{docker_container_name}} &>/dev/null | ||
if [ "$?" -eq "0" ]; then | ||
docker start -a {{docker_container_name}} | ||
else | ||
docker run {{docker_image_run_opt}} --name={{docker_container_name}} {{docker_image_name}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you know how long it takes to run other than the start? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Approximately same time. Will do a measurement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker run:
Docker start:
|
||
fi | ||
} | ||
|
||
stop() { | ||
docker stop {{docker_container_name}} | ||
} | ||
|
||
case "$1" in | ||
start|stop) | ||
$1 | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop}" | ||
exit 1 | ||
;; | ||
esac | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=LLDP container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=SNMP container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#!/bin/bash | ||
## This script is to automate loading of vendor specific docker images | ||
## and instalation of configuration files and vendor specific packages | ||
## to debian file system. | ||
## | ||
## USAGE: | ||
## ./sonic_debian_extension.sh FILESYSTEM_ROOT | ||
## PARAMETERS: | ||
## FILESYSTEM_ROOT | ||
## Path to debian file system root directory | ||
|
||
FILESYSTEM_ROOT=$1 | ||
[ -n "$FILESYSTEM_ROOT" ] || { | ||
echo "Error: no or empty FILESYSTEM_ROOT argument" | ||
exit 1 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add comment to describe what this mainly is doing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe simply saying load docker images and configurations In reply to: 98135052 [](ancestors = 98135052) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
## Enable debug output for script | ||
set -x -e | ||
|
||
. functions.sh | ||
BUILD_TEMPLATES=files/build_templates | ||
IMAGE_CONFIGS=files/image_config | ||
VENDOR_CONFIGS=src/sonic-config-engine/platform | ||
|
||
{% if installer_debs.strip() -%} | ||
clean_sys() { | ||
sudo umount $FILESYSTEM_ROOT/sys/fs/cgroup/* \ | ||
$FILESYSTEM_ROOT/sys/fs/cgroup \ | ||
$FILESYSTEM_ROOT/sys || true | ||
} | ||
trap_push clean_sys | ||
sudo LANG=C chroot $FILESYSTEM_ROOT mount sysfs /sys -t sysfs | ||
|
||
sudo chroot $FILESYSTEM_ROOT service docker start | ||
sudo chroot $FILESYSTEM_ROOT docker version | ||
|
||
# Install config engine dependencies | ||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ | ||
python-lxml \ | ||
python-jinja2 \ | ||
python-netaddr \ | ||
python-ipaddr \ | ||
python-yaml | ||
|
||
sudo dpkg --root=$FILESYSTEM_ROOT -i {{config_engine}} | ||
|
||
# Create all needed directories | ||
sudo mkdir -p $FILESYSTEM_ROOT/etc/ssw/ | ||
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/ | ||
sudo mkdir -p $FILESYSTEM_ROOT/etc/sonic/templates/ | ||
|
||
# Apply apt configuration files | ||
sudo cp $IMAGE_CONFIGS/apt/sources.list $FILESYSTEM_ROOT/etc/apt/ | ||
sudo cp -R $IMAGE_CONFIGS/apt/sources.list.d/ $FILESYSTEM_ROOT/etc/apt/ | ||
cat $IMAGE_CONFIGS/apt/sonic-dev.gpg.key | sudo LANG=C chroot $FILESYSTEM_ROOT apt-key add - | ||
|
||
# Apply environtment configuration files | ||
sudo cp $IMAGE_CONFIGS/environment/environment $FILESYSTEM_ROOT/etc/ | ||
sudo cp $IMAGE_CONFIGS/environment/motd $FILESYSTEM_ROOT/etc/ | ||
|
||
# Copy default minigraph | ||
sudo cp $IMAGE_CONFIGS/minigraph/minigraph_{{sonic_hwsku}}.xml $FILESYSTEM_ROOT/etc/sonic/minigraph.xml | ||
|
||
# Copy NTP configuration files and templates | ||
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.service $FILESYSTEM_ROOT/etc/systemd/system/ | ||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable ntp-config.service | ||
sudo cp $IMAGE_CONFIGS/ntp/ntp-config.sh $FILESYSTEM_ROOT/usr/bin/ | ||
sudo cp $IMAGE_CONFIGS/ntp/ntp.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ | ||
sudo cp $IMAGE_CONFIGS/ntp/ntp.yml $FILESYSTEM_ROOT/etc/sonic/ | ||
|
||
# Copy rsyslog configuration files and templates | ||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT/etc/systemd/system/ | ||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable rsyslog-config.service | ||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/ | ||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ | ||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.yml $FILESYSTEM_ROOT/etc/sonic/ | ||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/ | ||
|
||
# Copy interfaces configuration files and templates | ||
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.service $FILESYSTEM_ROOT/etc/systemd/system/ | ||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable interfaces-config.service | ||
sudo cp $IMAGE_CONFIGS/interfaces/interfaces-config.sh $FILESYSTEM_ROOT/usr/bin/ | ||
sudo cp $IMAGE_CONFIGS/interfaces/*.j2 $FILESYSTEM_ROOT/etc/sonic/templates/ | ||
|
||
# Copy SNMP configuration files | ||
sudo cp $IMAGE_CONFIGS/snmp/snmp.yml $FILESYSTEM_ROOT/etc/sonic/ | ||
|
||
# Generate system desription file | ||
export git_revision=$(git rev-parse --short HEAD) | ||
export sonic_hwsku={{sonic_hwsku}} | ||
export debian_version=`cat $FILESYSTEM_ROOT/etc/debian_version` | ||
export kernel_version={{kversion}} | ||
j2 $BUILD_TEMPLATES/sysDescription.j2 > sysDescription | ||
sudo mv sysDescription $FILESYSTEM_ROOT/etc/ssw/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. taoyu, can you take a look at this to make sure we are generate the correct sonic version here. |
||
|
||
# Copy sudoers configuration file | ||
sudo cp $IMAGE_CONFIGS/sudoers/sudoers $FILESYSTEM_ROOT/etc/ | ||
|
||
# Copy vendor specific configuration files | ||
sudo cp -R $VENDOR_CONFIGS/{{sonic_hwsku}}/ $FILESYSTEM_ROOT/etc/ssw/ | ||
|
||
{% for deb in installer_debs.strip().split(' ') -%} | ||
sudo dpkg --extract {{deb}} $FILESYSTEM_ROOT | ||
{% endfor %} | ||
## Run depmod command for target kernel modules | ||
sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}} | ||
{% endif %} | ||
{% if installer_images.strip() -%} | ||
{% for image in installer_images.strip().split(' ') -%} | ||
sudo LANG=C chroot $FILESYSTEM_ROOT docker load < {{image}} | ||
{% endfor %} | ||
sudo chroot $FILESYSTEM_ROOT service docker stop | ||
{% for script in installer_start_scrips.split(' ') -%} | ||
sudo cp {{script}} $FILESYSTEM_ROOT/usr/bin/ | ||
{% endfor %} | ||
{% for service in installer_services.split(' ') -%} | ||
sudo cp {{service}} $FILESYSTEM_ROOT/etc/systemd/system/ | ||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable {{service}} | ||
{% endfor %} | ||
sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true | ||
sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys | ||
{% endif %} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=orchagent container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
ExecStopPost=/usr/bin/syncd.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[Unit] | ||
Description=syncd container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User=root | ||
{% if sonic_hwsku == 'ACS-MSN2700' %} | ||
ExecStartPre=/etc/init.d/sxdkernel start | ||
ExecStartPre=/usr/bin/mst start | ||
ExecStartPre=/etc/mlnx/msn2700 start | ||
{% elif sonic_hwsku == 'AS7512' %} | ||
ExecStartPre=-/etc/init.d/xpnet.sh stop | ||
ExecStartPre=/etc/init.d/xpnet.sh start | ||
{% endif %} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
{% if sonic_hwsku == 'ACS-MSN2700' %} | ||
ExecStopPost=/etc/mlnx/msn2700 stop | ||
ExecStopPost=/etc/init.d/sxdkernel stop | ||
ExecStopPost=/usr/bin/mst stop | ||
{% elif sonic_hwsku == 'AS7512' %} | ||
ExecStopPost=/etc/init.d/xpnet.sh stop | ||
ExecStopPost=/etc/init.d/xpnet.sh start | ||
{% endif %} | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SONiC Software Version: SONiC-OS-{{git_revision}} HwSku: {{sonic_hwsku}} - Distribution: Debian {{debian_version}} - Kernel: {{kernel_version}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=TEAMD container | ||
Requires=database.service | ||
After=database.service | ||
|
||
[Service] | ||
User={{ sonicadmin_user }} | ||
ExecStart=/usr/bin/{{docker_container_name}}.sh start | ||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
Version: GnuPG v1 | ||
|
||
mQENBFQ1bTIBCAC7oGfkv/ck0XsLuG8cdcSB2ISqxFAcBvH9BitEtxmpW2uhykKk | ||
xY4rVD/4Uys1s3PF1/64QfPR+hYcewueOwz0ZAcLyFXXk4McICXaPq3NrLiWYKKX | ||
UZLnrPzcrGZoW/kHDDp4OmBiDmT1PGvZlpuimwkMCusUzIr7Cbbp2dIy8MERL5tA | ||
LcgLu3KL6clJ+aTW2jgepI1D7sTepOeGd7eRSb5njKg2M7k/93v/7MipZxiVtyXH | ||
B74YiK6jSbst5JpuYsLa/Dqryvx7Xq3n53oif892pv3euTduo1fYw8Hgh/OOYdeT | ||
c9WCj03KA1jCSFURjdrug0kR8BPlfjqtRLXFABEBAAG0JE1TIE9wZW4gVGVjaCA8 | ||
aW50ZXJvcEBtaWNyb3NvZnQuY29tPokBOAQTAQIAIgUCVDVtMgIbAwYLCQgHAwIG | ||
FQgCCQoLBBYCAwECHgECF4AACgkQsCxG30F6CJO1uAf/cmL68bM8YgF/61hkaY56 | ||
LqrppUTJH/w4fKq47Pf6KfgSLvxfNU6soi2KHYRjIvTRx3tV4vUM5n2plaQg2s8V | ||
/Epg4FeIRTk75YwiHAzLhLnp5cdUaTvC4j4mwxoB6j9Ty+fXJwQ0MvpDhIZb9vM4 | ||
GXw/fEQHCT4f3gx4nReeqE+FB2wVHleX9+Lpodu98JyJTKJRBRHYLqy6S+/lyp2W | ||
aBlsI1LOqBcx1uRK24U7duIpbYwIyrx0cafSruqR2GjVdu+imkhHyUn52VbzYhq1 | ||
af0rqYiZ1VOamVOG0By8+hVyNa1MLc1K2uWGs0o5fDe9F5/swbvLHVXI+M50Vs+m | ||
J7kBDQRUNW0yAQgAu7DkTVj0ZQC4F7bFivAwrdby8gCakTXOl1kcK622hjRJ8nam | ||
aZeW+eADfLRsTmdUmXgZu1YWS5Gn2ZVngC8SGPUBT071+oRETCz4uNB7IimB9QfP | ||
++orI6o2vmnVVsq5wWCbEdNU+TCVv1zjrYev5lwckkKpjHt6o8MNoX2DFuQymSyR | ||
eZKaqhdKmcji4Ke7OIYqwgPjch3wxzE1b5gNOR/iwxWyjjOffZPLr/VhIfIJRs86 | ||
dSXrwjHtEh810SKDLghHM0VAdY34nyC5ZZ61yhts5HtQDFK+9mNpH1mkc4gDBlgG | ||
266pVvknumK6lPNm/osF/cpjWmEw24ypcQIvOQARAQABiQEfBBgBAgAJBQJUNW0y | ||
AhsMAAoJELAsRt9BegiTMBUH/0sZ6gZy7mCTSAYT+NSXLFtGC2zNUVL80SWvfgYm | ||
k9XPVI22MrefZfQ6M01RylyxtWXjRM8UoN8SDKWPpXumzJf831f/7om5zwutaG7b | ||
tjDPYqRKJSbAIFZu2mN+uLrNQ2SV6XK7FoV0dtcrEX9S7RICb6i19D+70+Oh/qgU | ||
R04H1jqS29XBzqAlIzdBoA+sYAwbOIJsSL3YyNQcUv3B5+5yR/bo/L8pnUJt6iuL | ||
nWW+mi7r8gWPHDSrcdYq1TmmlOM7CwZPgWRZzkQPSeZz52Tt7IP47eyGJ09U4PIf | ||
FtMH1ElL2UgHoA/F9Q88e7LkztaTqE59uXWbIYyuSMJVvRU= | ||
=sb3d | ||
-----END PGP PUBLIC KEY BLOCK----- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deb http://debian-archive.trafficmanager.net/debian/ jessie main contrib non-free |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deb [arch=amd64] http://packages.microsoft.com/repos/sonic-dev/ jessie main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VTYSH_PAGER=more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this block?