Skip to content

Update docker images#463

Merged
sanderpick merged 3 commits intomasterfrom
sander/update-docker-images
Jan 5, 2021
Merged

Update docker images#463
sanderpick merged 3 commits intomasterfrom
sander/update-docker-images

Conversation

@sanderpick
Copy link
Contributor

@sanderpick sanderpick commented Dec 31, 2020

I've had a local branch with a bunch of docker edits for awhile, but haven't had the time to make a real PR. Here goes...

  • This updates all docker images to newer versions of tini and busybox.
  • Properly sets a non-privileged user instead of root and uses its home dir as the data dir (same dir, just now it's the user home as well).
  • Now, doing make hub-up or make buck-up will leverage new development images that allow for remote debugging by using a dlv based ENTRYPOINT and some additional -gcflags. Start a debug session with delve, or via an IDE (GoLand shown below). Using the dev docker compose files, the textile and buckets services exposes port 40000 for debugging (since you wouldn't run them at the same time), and billing exposes port 40001. This allows you to spin the whole stack locally with one line and still get debugging.

Screen Shot 2020-12-30 at 9 08 01 PM

  • Fixes the log file handling for all binaries. Previously, all log files were titled threads.log since a go-threads util was being used everywhere. Related, the log file must now be specified, which is a more expected behavior. The default now is just to log to stdout.

Signed-off-by: Sander Pick <sanderpick@gmail.com>
Signed-off-by: Sander Pick <sanderpick@gmail.com>
@sanderpick sanderpick force-pushed the sander/update-docker-images branch from 365e3e5 to 5fc99a1 Compare December 31, 2020 05:09
[![Made by Textile](https://img.shields.io/badge/made%20by-Textile-informational.svg?style=popout-square)](https://textile.io)
[![Chat on Slack](https://img.shields.io/badge/slack-slack.textile.io-informational.svg?style=popout-square)](https://slack.textile.io)
[![GitHub license](https://img.shields.io/github/license/textileio/textile.svg?style=popout-square)](./LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/textileio/textile?style=flat-square)](https://goreportcard.com/report/github.com/textileio/textile?style=flat-square)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing since it's broken.

"time"

logging "github.com/ipfs/go-log"
"gopkg.in/segmentio/analytics-go.v3"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double import.


logging "github.com/ipfs/go-log"
"gopkg.in/segmentio/analytics-go.v3"
logging "github.com/ipfs/go-log/v2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched everything to v2.


VOLUME $BUCKETS_PATH

ENTRYPOINT ["dlv", "--listen=0.0.0.0:40000", "--headless=true", "--accept-multiclient", "--continue", "--api-version=2", "exec", "/usr/local/bin/buckd"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exec the binary with dlv and listen on 40000. This allows multiple debug sessions to attach, without requiring any.

Signed-off-by: Sander Pick <sanderpick@gmail.com>
Comment on lines +30 to +33
security_opt:
- "seccomp:unconfined"
cap_add:
- SYS_PTRACE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things needed for remote debugging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool.

@sanderpick sanderpick self-assigned this Dec 31, 2020
Copy link
Contributor

@jsign jsign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Cool thing for remote debugging.

Comment on lines 230 to +233
debug := config.Viper.GetBool("log.debug")
logFile := config.Viper.GetString("log.file")
if logFile != "" {
err = util.SetupDefaultLoggingConfig(logFile)
err = cmd.SetupDefaultLoggingConfig(logFile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: SetupDefaultLoggingConfig seems to have a fixed ERROR level. Is that correct considering the log.debug flag? Or maybe log.debug only applies if log.file is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just sets the default on start, and then later on the debug flag is applied to textile modules. Setting anything other than debug here would cause all the libp2p modules to spew lots of logs.

Comment on lines +30 to +33
security_opt:
- "seccomp:unconfined"
cap_add:
- SYS_PTRACE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool.

Copy link
Contributor

@textileben textileben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanderpick sanderpick merged commit e7b073d into master Jan 5, 2021
@sanderpick sanderpick deleted the sander/update-docker-images branch January 5, 2021 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants