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

[services] introduce sonic.target #10

Closed
wants to merge 5 commits into from
Closed
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
4 changes: 3 additions & 1 deletion files/build_templates/dhcp_relay.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=DHCP relay container
Requires=updategraph.service
After=updategraph.service swss.service syncd.service teamd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -15,4 +17,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/gbsyncd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ ConditionPathExists=!/usr/share/sonic/hwsku/gearbox_config.json
After=database.service updategraph.service
After=interfaces-config.service
After=swss.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service

[Service]
Expand All @@ -15,4 +17,4 @@ ExecStart=/usr/local/bin/gbsyncd.sh wait
ExecStop=/usr/local/bin/gbsyncd.sh stop

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/iccpd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=ICCPD container
Requires=updategraph.service swss.service
After=updategraph.service swss.service
BindsTo=sonic.target
After=sonic.target

[Service]
User={{ sonicadmin_user }}
Expand All @@ -10,4 +12,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop

[Install]
WantedBy=multi-user.target swss.service
WantedBy=sonic.target swss.service
3 changes: 2 additions & 1 deletion files/build_templates/mgmt-framework.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Description=Management Framework container
Requires=database.service
After=database.service swss.service syncd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service

[Service]
User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop

4 changes: 3 additions & 1 deletion files/build_templates/mgmt-framework.timer
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[Unit]
Description=Delays management framework container until SONiC has started
PartOf=mgmt-framework.service

[Timer]
OnUnitActiveSec=0 sec
OnBootSec=3min 30 sec
Unit=mgmt-framework.service

[Install]
WantedBy=timers.target
WantedBy=timers.target sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/nat.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=NAT container
Requires=updategraph.service
After=updategraph.service swss.service syncd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -15,5 +17,5 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target

4 changes: 3 additions & 1 deletion files/build_templates/per_namespace/bgp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service
After=database{% if multi_instance == 'true' %}@%i{% endif %}.service
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -18,4 +20,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
6 changes: 5 additions & 1 deletion files/build_templates/per_namespace/lldp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service
After=syncd{% if multi_instance == 'true' %}@%i{% endif %}.service
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -19,4 +23,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/per_namespace/swss.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Requires=opennsl-modules.service
Requires=updategraph.service
After=updategraph.service
After=interfaces-config.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -26,4 +28,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/per_namespace/syncd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ After=nps-modules.service
Requires=updategraph.service
After=updategraph.service
After=interfaces-config.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service

[Service]
Expand All @@ -30,4 +32,4 @@ TimeoutStartSec=150
{% endif %}

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/per_namespace/teamd.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Description=TEAMD container
After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -16,4 +18,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/pmon.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ After=database.service updategraph.service
{% if sonic_asic_platform == 'mellanox' %}
After=syncd.service
{% endif %}
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -18,4 +20,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/radv.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Description=Router advertiser container
Requires=updategraph.service
After=updategraph.service swss.service syncd.service
Before=ntp-config.service
BindsTo=sonic.target
After=sonic.target
StartLimitIntervalSec=1200
StartLimitBurst=3

Expand All @@ -15,4 +17,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/restapi.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=RestAPI container
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service

[Service]
Expand All @@ -13,4 +15,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 3 additions & 1 deletion files/build_templates/sflow.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Description=sFlow container
Requisite=swss.service
After=swss.service syncd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
Expand All @@ -15,4 +17,4 @@ Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
4 changes: 2 additions & 2 deletions files/build_templates/snmp.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ Description=SNMP container
Requires=updategraph.service
Requisite=swss.service
After=updategraph.service swss.service syncd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
Conflicts=snmp.timer
StartLimitIntervalSec=1200
StartLimitBurst=3

Expand All @@ -14,4 +15,3 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30

2 changes: 1 addition & 1 deletion files/build_templates/snmp.timer
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Delays snmp container until SONiC has started
Conflicts=snmp.service
PartOf=snmp.service

[Timer]
OnUnitActiveSec=0 sec
Expand Down
5 changes: 5 additions & 0 deletions files/build_templates/sonic.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[Unit]
Description=SONiC services target.

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ sudo cp $BUILD_TEMPLATES/mgmt-framework.timer $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_S
echo "mgmt-framework.timer" | sudo tee -a $GENERATED_SERVICE_FILE
{% endif %}

sudo cp $BUILD_TEMPLATES/sonic.target $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable sonic.target

sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python-dev python3-dev
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y build-essential libssl-dev swig
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y
Expand Down
3 changes: 2 additions & 1 deletion files/build_templates/telemetry.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Description=Telemetry container
Requires=database.service
After=database.service swss.service syncd.service
Before=ntp-config.service
BindsTo=sonic.target
After=sonic.target
StartLimitIntervalSec=1200
StartLimitBurst=3

Expand All @@ -13,4 +15,3 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30

4 changes: 3 additions & 1 deletion files/build_templates/telemetry.timer
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[Unit]
Description=Delays telemetry container until SONiC has started
PartOf=telemetry.service

[Timer]
OnUnitActiveSec=0 sec
OnBootSec=3min 30 sec
Unit=telemetry.service

[Install]
WantedBy=timers.target
WantedBy=timers.target sonic.target
5 changes: 4 additions & 1 deletion files/image_config/hostcfgd/hostcfgd.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Description=Host config enforcer daemon
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=simple
ExecStart=/usr/bin/hostcfgd

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target

5 changes: 4 additions & 1 deletion files/image_config/hostname/hostname-config.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Description=Update hostname based on configdb
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/hostname-config.sh

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
5 changes: 4 additions & 1 deletion files/image_config/interfaces/interfaces-config.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Description=Update interfaces configuration
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/interfaces-config.sh

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
5 changes: 4 additions & 1 deletion files/image_config/ntp/ntp-config.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Description=Update NTP configuration
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ntp-config.sh

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
5 changes: 4 additions & 1 deletion files/image_config/rsyslog/rsyslog-config.service
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Description=Update rsyslog configuration
Requires=updategraph.service
After=updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/rsyslog-config.sh

[Install]
WantedBy=multi-user.target
WantedBy=sonic.target
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
Description=Process and docker CPU/memory utilization data export daemon
Requires=database.service updategraph.service
After=database.service updategraph.service
BindsTo=sonic.target
After=sonic.target

[Service]
Type=simple
ExecStart=/usr/local/bin/procdockerstatsd
Restart=always

[Install]
WantedBy=multi-user.target

WantedBy=sonic.target