2019-06-22 13:26:23 -05:00
{ % from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
2020-05-29 05:29:49 -05:00
FROM docker-config-engine-buster
2016-12-05 13:12:19 -06:00
2018-06-25 12:48:42 -05:00
ARG docker_container_name
2019-01-11 19:46:32 -06:00
RUN [ -f /etc/rsyslog.conf ] && sed -ri " s/%syslogtag%/ $docker_container_name #%syslogtag%/; " /etc/rsyslog.conf
2018-06-25 12:48:42 -05:00
2018-05-02 13:46:21 -05:00
# Make apt-get non-interactive
2017-02-16 23:48:49 -06:00
ENV DEBIAN_FRONTEND = noninteractive
2018-05-02 13:46:21 -05:00
# Update apt's cache of available packages
2016-12-05 13:12:19 -06:00
RUN apt-get update
2020-06-27 03:17:20 -05:00
# install redis-server
2020-09-08 21:30:14 -05:00
RUN curl -o redis-tools_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-tools_6.0.6-1~bpo10+1_amd64.deb?sv=2015-04-05&sr=b&sig=73zbmjkf3pi%2Bn0R8Hy7CWT2EUvOAyzM5aLYJWCLySGM%3D&se=2030-09-06T19%3A44%3A59Z&sp=r"
RUN curl -o redis-server_6.0.6-1~bpo10+1_amd64.deb "https://sonicstorage.blob.core.windows.net/packages/redis/redis-server_6.0.6-1~bpo10+1_amd64.deb?sv=2015-04-05&sr=b&sig=2Ketg7BmkZEaTxR%2FgvAFVmhjn7ywdmkc7l2T2rsL57o%3D&se=2030-09-06T19%3A45%3A20Z&sp=r"
RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f
RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb redis-server_6.0.6-1~bpo10+1_amd64.deb
2020-06-27 03:17:20 -05:00
2018-05-02 13:46:21 -05:00
{ % if docker_database_debs.strip( ) -%}
# Copy locally-built Debian package dependencies
2019-06-22 13:26:23 -05:00
{ { copy_files( "debs/" , docker_database_debs.split( ' ' ) , "/debs/" ) } }
2016-12-05 13:12:19 -06:00
2018-05-02 13:46:21 -05:00
# Install locally-built Debian packages and implicitly install their dependencies
2019-06-22 13:26:23 -05:00
{ { install_debian_packages( docker_database_debs.split( ' ' ) ) } }
2018-05-02 13:46:21 -05:00
{ %- endif %}
# Clean up
2019-06-22 13:26:23 -05:00
RUN apt-get clean -y && \
apt-get autoclean -y && \
apt-get autoremove -y && \
rm -rf /debs ~/.cache && \
sed -ri ' s/^( save .*$) /# \1 /g; \
2018-05-02 13:46:21 -05:00
s/^daemonize yes$/daemonize no/; \
s/^logfile .*$/logfile "" /; \
s/^# syslog-enabled no$/syslog-enabled no/; \
s/^# unixsocket/unixsocket/; \
2019-07-04 00:16:10 -05:00
s/redis-server.sock/redis.sock/g; \
2017-04-26 13:09:58 -05:00
s/^client-output-buffer-limit pubsub [ 0-9] +mb [ 0-9] +mb [ 0-9] +/client-output-buffer-limit pubsub 0 0 0/ \
2016-12-05 13:12:19 -06:00
' /etc/redis/redis.conf
create multiple Redis DB instances based on CONFIG at /etc/sonic/database_config.json (#2182)
this is the first step to moving different databases tables into different database instances
in this PR, only handle multiple database instances creation based on user configuration at /etc/sonic/database_config.json
we keep current method to create single database instance if no extra/new DATABASE configuration exist in database_config.json file.
if user try to configure more db instances at database_config.json , we create those new db instances along with the original db instance existing today.
The configuration is as below, later we can add more db related information if needed:
{
...
"DATABASE": {
"redis-db-01" : {
"port" : "6380",
"database": ["APPL_DB", "STATE_DB"]
},
"redis-db-02" : {
"port" : "6381",
"database":["ASIC_DB"]
},
}
...
}
The detail description is at design doc at Azure/SONiC#271
The main idea is : when database.sh started, we check the configuration and generate corresponding scripts.
rc.local service handle old_config copy when loading new images, there is no dependency between rc.local and database service today, for safety and make sure the copy operation are done before database try to read it, we make database service run after rc.local
Then database docker started, we check the configuration and generate corresponding scripts/.conf in database docker as well.
based on those conf, we create databases instances as required.
at last, we ping_pong check database are up and continue
Signed-off-by: Dong Zhang d.zhang@alibaba-inc.com
2019-08-28 13:15:10 -05:00
COPY [ "supervisord.conf.j2" , "/usr/share/sonic/templates/" ]
COPY [ "docker-database-init.sh" , "/usr/local/bin/" ]
2020-05-08 23:24:05 -05:00
COPY [ "database_config.json.j2" , "/usr/share/sonic/templates/" ]
COPY [ "database_global.json.j2" , "/usr/share/sonic/templates/" ]
2020-02-11 16:03:02 -06:00
COPY [ "files/supervisor-proc-exit-listener" , "/usr/bin" ]
2020-07-01 17:58:53 -05:00
COPY [ "files/sysctl-net.conf" , "/etc/sysctl.d/" ]
2020-02-11 16:03:02 -06:00
COPY [ "critical_processes" , "/etc/supervisor" ]
2020-10-14 17:15:24 -05:00
COPY [ "files/update_chassisdb_config" , "/usr/local/bin/" ]
2017-05-08 17:43:31 -05:00
create multiple Redis DB instances based on CONFIG at /etc/sonic/database_config.json (#2182)
this is the first step to moving different databases tables into different database instances
in this PR, only handle multiple database instances creation based on user configuration at /etc/sonic/database_config.json
we keep current method to create single database instance if no extra/new DATABASE configuration exist in database_config.json file.
if user try to configure more db instances at database_config.json , we create those new db instances along with the original db instance existing today.
The configuration is as below, later we can add more db related information if needed:
{
...
"DATABASE": {
"redis-db-01" : {
"port" : "6380",
"database": ["APPL_DB", "STATE_DB"]
},
"redis-db-02" : {
"port" : "6381",
"database":["ASIC_DB"]
},
}
...
}
The detail description is at design doc at Azure/SONiC#271
The main idea is : when database.sh started, we check the configuration and generate corresponding scripts.
rc.local service handle old_config copy when loading new images, there is no dependency between rc.local and database service today, for safety and make sure the copy operation are done before database try to read it, we make database service run after rc.local
Then database docker started, we check the configuration and generate corresponding scripts/.conf in database docker as well.
based on those conf, we create databases instances as required.
at last, we ping_pong check database are up and continue
Signed-off-by: Dong Zhang d.zhang@alibaba-inc.com
2019-08-28 13:15:10 -05:00
ENTRYPOINT [ "/usr/local/bin/docker-database-init.sh" ]