forked from apache/trafficcontrol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parents to varnish cache (apache#7669)
* Add varnishcfg package and parent configuration * Add Varnish Dockerfile to be used in CIAB * Add license to Varnsih Dockerfile * Add systemctl.sh to handle Varnish service and integrate Varnish with t3c-apply * Move host changes to BE fetch, change varnish dir and make test more readable * Remove Varnish package release and arch, add GoDoc and move licenses * Move license text
- Loading branch information
1 parent
957f42e
commit 1980540
Showing
22 changed files
with
1,097 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cfgfile | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import ( | ||
"github.com/apache/trafficcontrol/cache-config/t3c-generate/config" | ||
"github.com/apache/trafficcontrol/cache-config/t3cutil" | ||
"github.com/apache/trafficcontrol/lib/varnishcfg" | ||
) | ||
|
||
// GetVarnishConfigs returns varnish configuration files | ||
// TODO: add varnishncsa and hitch configs | ||
func GetVarnishConfigs(toData *t3cutil.ConfigData, cfg config.Cfg) ([]t3cutil.ATSConfigFile, error) { | ||
vclBuilder := varnishcfg.NewVCLBuilder(toData) | ||
vcl, warnings, err := vclBuilder.BuildVCLFile() | ||
logWarnings("Generating varnish configuration files: ", warnings) | ||
|
||
configs := make([]t3cutil.ATSConfigFile, 0) | ||
// TODO: should be parameterized and generated from varnishcfg | ||
configs = append(configs, t3cutil.ATSConfigFile{ | ||
Name: "default.vcl", | ||
Text: vcl, | ||
Path: cfg.Dir, | ||
ContentType: "text/plain; charset=us-ascii", | ||
LineComment: "//", | ||
Secure: false, | ||
}) | ||
return configs, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
ARG BASE_IMAGE=rockylinux \ | ||
RHEL_VERSION=8 | ||
FROM ${BASE_IMAGE}:${RHEL_VERSION} AS common-varnish-cache-config-layers | ||
ARG RHEL_VERSION=8 | ||
# Makes RHEL_VERSION available at runtime | ||
ENV RHEL_VERSION="$RHEL_VERSION" | ||
|
||
RUN dnf module disable varnish -y && yum install -y epel-release | ||
|
||
RUN curl -s https://packagecloud.io/install/repositories/varnishcache/varnish73/script.rpm.sh | bash | ||
|
||
RUN yum install varnish-7.3.0 -y | ||
|
||
RUN dnf install -y bind-utils kyotocabinet-libs initscripts iproute net-tools nmap-ncat gettext autoconf automake libtool gcc-c++ cronie glibc-devel openssl-devel git perl && \ | ||
dnf install -y jq logrotate findutils && \ | ||
dnf clean all | ||
|
||
|
||
COPY infrastructure/cdn-in-a-box/varnish/run.sh infrastructure/cdn-in-a-box/traffic_ops/to-access.sh infrastructure/cdn-in-a-box/enroller/server_template.json / | ||
|
||
COPY infrastructure/cdn-in-a-box/dns/set-dns.sh \ | ||
infrastructure/cdn-in-a-box/dns/insert-self-into-dns.sh \ | ||
/usr/local/sbin/ | ||
|
||
|
||
COPY infrastructure/cdn-in-a-box/varnish/systemctl.sh /usr/bin/systemctl | ||
|
||
ARG ORT_RPM=infrastructure/cdn-in-a-box/cache/trafficcontrol-cache-config.rpm | ||
COPY $ORT_RPM / | ||
RUN rpm -Uvh /$(basename $ORT_RPM) &&\ | ||
rm /$(basename $ORT_RPM) | ||
|
||
COPY infrastructure/cdn-in-a-box/varnish/traffic_ops_ort.crontab /etc/cron.d/traffic_ops_ort-cron-template | ||
|
||
|
||
CMD /run.sh | ||
|
||
FROM common-varnish-cache-config-layers AS mid | ||
ENV CACHE_TYPE=mid | ||
COPY infrastructure/cdn-in-a-box/mid/init.d/ /opt/init.d/ | ||
|
||
FROM common-varnish-cache-config-layers AS edge | ||
ENV CACHE_TYPE=edge | ||
COPY infrastructure/cdn-in-a-box/edge/init.d/ /opt/init.d/ | ||
|
||
|
Oops, something went wrong.