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
[BEAM-9889] Populate local instance of InfluxDB with data #12167
Changes from all commits
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,35 @@ | ||
################################################################################ | ||
# 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. | ||
################################################################################ | ||
|
||
FROM python:3-slim | ||
|
||
RUN pip install --no-cache-dir gsutil | ||
|
||
WORKDIR / | ||
|
||
RUN gsutil cp gs://apache-beam-testing-metrics/influxdb-backup.tar.gz . && \ | ||
tar xzf influxdb-backup.tar.gz | ||
|
||
|
||
FROM influxdb:1.8.0 | ||
|
||
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /wait-for-it.sh | ||
|
||
RUN chmod +x /wait-for-it.sh | ||
|
||
COPY --from=0 /backup /backup |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
################################################################################ | ||
# 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. | ||
################################################################################ | ||
|
||
FROM python:3-slim | ||
|
||
# google-compute-engine package allows to obtain credentials for service | ||
# account specified in .boto file. | ||
RUN pip install --no-cache-dir gsutil google-compute-engine | ||
|
||
ADD .boto /etc/boto.cfg |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,35 +16,51 @@ | |
# limitations under the License. | ||
################################################################################ | ||
|
||
# A Cron Job that makes a full InfluxDB backup every week. | ||
# A Cron Job that makes a full InfluxDB backup every day and sends it to | ||
# GCS bucket. | ||
apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
labels: | ||
app: beammetrics | ||
name: influxdb-autobackup | ||
spec: | ||
schedule: "@weekly" | ||
schedule: "@daily" | ||
concurrencyPolicy: Forbid | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- image: influxdb:1.8.0 | ||
name: influxdb-autobackup | ||
# Using "initContainers" ensures that "create_backups" completes | ||
# before "copy-to-gcs-bucket" begins. | ||
initContainers: | ||
- name: create-backup | ||
image: influxdb:1.8.0 | ||
args: | ||
- influxd | ||
- backup | ||
- -portable | ||
- -host | ||
- influxdb-rpc:8088 | ||
- /backups | ||
- /backup | ||
volumeMounts: | ||
- mountPath: /backup | ||
name: shared-data | ||
- name: copy-to-gsc-bucket | ||
image: gcr.io/apache-beam-testing/gsutil | ||
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. As I can understand, we overwrite same backup each time. Given daily creation of backups and noone is paged when something goes wrong, this backup can be easily corrupted as well. Though it is ok for current PR, it's best to add some rotation to backups, keeping 1-2 week old backups available. 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. Yes, we overwrite the same backup each time, but the bucket has object versioning enabled. According to the doc:
If you run |
||
command: ['sh', '-c', 'tar czf influxdb-backup.tar.gz /backup | ||
&& gsutil cp influxdb-backup.tar.gz | ||
gs://apache-beam-testing-metrics/'] | ||
volumeMounts: | ||
- mountPath: /backups | ||
name: influxdb-backups | ||
- mountPath: /backup | ||
name: shared-data | ||
readOnly: true | ||
containers: | ||
- name: job-done | ||
image: busybox | ||
command: ['sh', '-c' , | ||
'echo "create-backup and copy-to-gsc-bucket completed"'] | ||
restartPolicy: Never | ||
volumes: | ||
- name: influxdb-backups | ||
persistentVolumeClaim: | ||
claimName: influxdb-backups | ||
- name: shared-data | ||
emptyDir: {} |
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.
Are these backups available to non-committers?
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.
Everyone on the Internet has read-only access to the bucket. Grafana dashboards are already public, so it doesn't change anything in terms of security or privacy