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

refactor(systemd): rename to kubo #9099

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RubenKelevra
Copy link
Contributor

@lidel will/is the environmental variable IPFS_PATH also (be) renamed to KUBO_PATH?

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thanks! Needs another pass – we did not rename binary nor any env variable.

See "minimal rename" (#8959).

misc/systemd/kubo-api.socket Outdated Show resolved Hide resolved
misc/systemd/kubo-hardened.service Outdated Show resolved Hide resolved
misc/systemd/kubo.service Show resolved Hide resolved
@RubenKelevra RubenKelevra force-pushed the feat/refactor_systemd branch 2 times, most recently from b4783a9 to b6a9fcf Compare July 23, 2022 18:10
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

I am concerned about the side effects here: as noted in #8959 the rule of thumb is to keep changes minimal, avoiding breaking existing users and tutorials that were created in the past 7 years.

Changing binary name, user ang group sound like extremely breaking change, no?
How things will behave for existing users?

We are NOT planning any change of binary name (breaks too many things), so
it makes little sense to rename user groups and other things just for the sake of changing.

Ideally, changes in this PR should be shallow, limited to Description fields.
Mind dialing this down a bit?

misc/systemd/kubo-hardened.service Show resolved Hide resolved
misc/systemd/kubo-hardened.service Outdated Show resolved Hide resolved
misc/systemd/kubo-hardened.service Show resolved Hide resolved
misc/systemd/kubo-api.socket Outdated Show resolved Hide resolved
@lidel lidel changed the title refactor: rename to kubo - systemd part refactor(systemd): rename to kubo Jul 25, 2022
@RubenKelevra
Copy link
Contributor Author

RubenKelevra commented Aug 19, 2022

@lidel overall I feel like these changes are not critical in terms of breaking people's setups. The files are mainly meant for package maintainers, not regular users.

So if a file changes and the package maintainer likes to keep something in an older "fashion" no one will hinder him. :)

Migration from x to y between versions and having scripts do the migrations is pretty common. Here for example is my script to do this for arch as an example.

post_upgrade() {
  
  ## search for old location of kubo data and move data

  if [ -f '/var/lib/ipfs/config' ]; then
    daemon_was_running='no'
    echo ":: ipfs-to-kubo upgrade: stopping ipfs.service if running..."
    if [ $(systemctl is-active --quiet ipfs.service) ]; then
      daemon_was_running='yes'
      systemctl stop ipfs.service >/dev/null 2>&1 || true
    fi
    echo ":: moving existing ipfs data from '/var/lib/ipfs/' to '/var/lib/kubo/'..."
    mkdir -p /var/lib/kubo
    mv /var/lib/ipfs /var/lib/kubo >/dev/null 2>&1 || true
    chown kubo: -R /var/lib/kubo/ || true
  fi

  # in case the daemon was never started, generate a configuration

  if [ ! -f /var/lib/kubo/config ]; then
    systemctl restart systemd-sysusers.service

    mkdir -p /var/lib/kubo/
    chown kubo: -R /var/lib/kubo/
    su kubo -s /bin/bash -c "export IPFS_PATH='/var/lib/kubo/'; kubo init"
  else
    if [ $(systemctl is-active --quiet kubo.service) ]; then
      daemon_was_running='yes'
      systemctl stop kubo.service >/dev/null 2>&1 || true
    fi
  fi

  # do data migration
  
  su kubo -s /bin/bash -c "export IPFS_PATH='/var/lib/kubo/'; kubo repo migrate"
  
  if [ "$daemon_was_running" == 'yes' ]; then
    systemctl start kubo.service >/dev/null 2>&1 || true
  fi

}

post_install() {

  # do every check an upgrade would do

  post_upgrade
}

@RubenKelevra
Copy link
Contributor Author

@lidel maybe we should add an $KUBO_REPO environmental variable, which is used preferably when set. If unset kubo will fallback to the (then to be deprecated) $IPFS_PATH?

@BigLep BigLep added this to the Best Effort Track milestone Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🔎 In Review
Development

Successfully merging this pull request may close these issues.

3 participants