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

Heroku deployment (DO NOT MERGE) #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY --from=builder /lib/ld* /lib/libssl.* /lib/libcrypto.* /lib/
COPY --from=builder /etc/group /etc/
COPY --from=builder /etc/ssl /etc/ssl

COPY databunker.yaml /databunker/conf/
COPY databunker*.yaml /databunker/conf/
RUN /bin/busybox mkdir -p /databunker/data && \
/bin/busybox mkdir -p /databunker/certs && \
/bin/busybox ln -s /bin/busybox /bin/addgroup && \
Expand All @@ -35,8 +35,8 @@ RUN /bin/busybox mkdir -p /databunker/data && \
addgroup -S appgroup && adduser --no-create-home -S appuser -G appgroup && \
chown appuser:appgroup /databunker/data
USER appuser
COPY --from=builder /go/bin/databunker /go/src/securitybunker/databunker/run.sh /go/src/securitybunker/databunker/health-check.sh /databunker/bin/
COPY --from=builder /go/bin/databunker /go/src/securitybunker/databunker/run*.sh /go/src/securitybunker/databunker/health-check.sh /databunker/bin/
EXPOSE 3000
HEALTHCHECK --interval=5s --timeout=3s --start-period=33s --retries=3 CMD /databunker/bin/health-check.sh
ENTRYPOINT ["/bin/sh", "/databunker/bin/run.sh"]
ENTRYPOINT ["/bin/sh", "/databunker/bin/run-heroku.sh"]
#CMD ["/bin/sh", "-x", "-c", "/go/bin/databunker -init"]
80 changes: 80 additions & 0 deletions databunker-heroku.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Server configurations
generic:
# allow to create user object without login
create_user_without_access_token: true
# use separate app tables, default false
# use_separate_app_tables: true
# specify if API call to list users is available (default false)
# list_users: true
selfservice:
# specifies if user can remove himself withour Admin/DPO approval (default false)
forget_me: false
# specifies if user can change his data without Admin/DPO approval (default false)
user_record_change: true
# specifies a list of app-data objects user can change without approval
app_record_change: ["*"]
notification:
# url that receives notifications:
# - bad login
# - forget me
# - user profile change
# - consent change
# user details are send as json data.
#notification_url: "https://httpbin.org/post"
policy:
# max time to store records, untill they are deleted
max_user_retention_period: "3m"
max_audit_retention_period: "6m"
max_session_retention_period: "1h"
max_shareable_record_retention_period: "1m"
#ssl:
# # ssl configuration
# ssl_certificate: "/databunker/certs/server.cer"
# ssl_certificate_key: "/databunker/certs/server.key"
sms:
# REQUIRED: Specify SMS gateway URL.
# Available modifiers for url parameters: {token}, {from}, {phone}, {msg}
# url: "https://sms-gateway.com/send?token=_TOKEN_&from=_FROM_&phone=_PHONE_&msg=_MSG_"
# OPTIONAL: Specify From address
# from: ""
# OPTIONAL: Specify SMS gateway access token
# token: ""
# OPTIONAL: Specify SMS gateway Basic Auth header, format: username:password
# basic_auth: "user:pssword"
# OPTIONAL: Specify SMS gateway HTTP request method: GET or POST. Default is GET
# method: "GET"
# OPTIONAL: Specify SMS gateway HTTP request custom header. Can be used for authorization.
# custom_header: "x-token: value"
# OTIONAL: Specify SMS gateway HTTP request Content Type. It can be application/json.
# By default application/x-www-form-urlencoded
# content_type: "json"
# REQUIRED FOR POST REQUEST: POST body. Available modifiers: _TOKEN_, _FROM_, _PHONE_, _MSG_
# Example for application/json POST request:
# body: '{"from":"_FROM_","phone":"_PHONE_","message":"_MSG_"}'
# Example for application/x-www-form-urlencoded POST request
# body: 'from=_FROM_&phone=_PHONE_&message=_MSG_'
# default country when sending out SMS
# Use country code when normalizing phone numbers. Use country code as defined here:
# https://github.com/ttacon/libphonenumber/blob/master/countrycodetoregionmap.go
default_country: "GB"
server:
host: "0.0.0.0"
# port: 3000
smtp:
# You need to get SMTP server to send out email notification for example to allow user login.
# You can look for a email service company offering SMTP services. You can pick from here:
# https://privacybunker.io/blog/european-cloud-saas-vendors/
server: "email-smtp-server.com"
port: 587
user: "user@your-company.com"
pass: ""
sender: "bot@databunker.your-company.com"
ui:
logo_link: "/site/img/logo-example.png"
company_title: "Your company here"
company_link: "https://privacybunker.io/"
term_of_service_title: "Your Terms of service link"
term_of_service_link: "https://privacybunker.io/"
privacy_policy_title: "Your Privacy Policy link"
privacy_policy_link: "https://privacybunker.io/"
custom_css_link: ""
5 changes: 5 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
docker:
web: Dockerfile


16 changes: 16 additions & 0 deletions run-heroku.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

if [ -z "$DATABUNKER_MASTERKEY" ]; then
echo "DATABUNKER_MASTERKEY environment value is empty"
/bin/busybox sleep 60
exit
fi

echo "-------------ENV-------------"
/bin/busybox env

echo "-------------FIND------------"
/bin/busybox find /databunker

echo "-------------RUN-------------"
/databunker/bin/databunker -start -db $PGSQL_DB -conf /databunker/conf/databunker-heroku.yaml
2 changes: 1 addition & 1 deletion src/bunker.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Config struct {
DefaultCountry string `yaml:"default_country"`
}
Server struct {
Port string `yaml:"port" envconfig:"BUNKER_PORT"`
Port string `yaml:"port" envconfig:"PORT"`
Host string `yaml:"host" envconfig:"BUNKER_HOST"`
} `yaml:"server"`
SMTP struct {
Expand Down