cryptoadvance / specter-desktop

A desktop GUI for Bitcoin Core optimised to work with hardware wallets
MIT License
794 stars 237 forks source link

Specter-Desktop Snap #412

Open AusDavo opened 4 years ago

AusDavo commented 4 years ago

Python projects, such as Specter-Desktop, are especially suited to distribution as a Snap. It may take less than an hour for a skilled person to produce such a package. https://snapcraft.io/docs/python-apps

A Specter-Desktop Snap is needed for use on Ubuntu Core. Ubuntu Core is minimalist and secure OS which is good for headless bitcoin nodes. Ubuntu Core exclusively runs Snaps. https://ubuntu.com/core

Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and may be installed from the Snap Store, the app store for Linux with an audience of millions. These applications are bundled with their dependencies and assets and they are very simple to install. Even Bitcoin Core is offered as a Snap now. https://snapcraft.io/

I don't think that I am skilled enough to complete this but I'm very willing to help if I can!

AusDavo commented 4 years ago

I have started trying to prepare the Snap package myself. I have hit a problem. Please, would anyone here be able to assist? This is the error message that I have:

ERROR: Could not find a version that satisfies the requirement cryptoadvance.specter (from versions: vx.y.z-get-replaced-by-release-script) ERROR: No matching distribution found for cryptoadvance.specter Failed to run ‘/home/david/mysnaps/specter-desktop/parts/my-part/install/usr/bin/python3 -m pip install --user --no-compile --no-index --find-links /home/david/mysnaps/specter-desktop/parts/my-part/python-packages protobuf hwi cffi pbkdf2 Jinja2 PySocks mnemonic Click semver pycparser certifi itsdangerous hidapi Werkzeug libusb1 ecdsa MarkupSafe base58 stem chardet idna pyaes noiseprotocol cryptoadvance.specter typing_extensions urllib3 requests daemonize Flask_Login pyserial cryptography Flask_Cors bitbox02 six Flask python_dotenv --upgrade --no-deps’: Exited with code 1.

I have asked or help in the Snapcraft Forum too.

https://forum.snapcraft.io/t/error-could-not-find-a-version/20145

stepansnigirev commented 4 years ago

In the setup.py#L17 we have a version vx.y.z-get-replaced-by-release-script that is replaced by the actual version whenever we make a new tag. Are you trying to build the snap from master branch? Maybe you can try replacing this version in setup.py manually for now, and if snap build works - we can integrate it in the CI?

P.S. Sorry I didn't react to the issue earlier, I never worked with Ubuntu Core - probably should try it out. I like the idea to have a snap.

stepansnigirev commented 4 years ago

@k9ert , you may be interested as well.

AusDavo commented 4 years ago

Stepan! Thanks for your reply. Great software and thank you.

I am a real novice but I will try your suggestion. Sorry if I get some of the terminology wrong.

Yes, I have downloaded a fork of the master branch. It is from this that I am attempting to build the Snap package.

I'll modify the setup script (setup.py#L17) by changing vx.y.z-get-replaced-by-release-script to 0.8.0? I'll try it when I'm back at my home machine.

Thanks again!

stepansnigirev commented 4 years ago

Yes, the script is replacing vx.y.z-get-replaced-by-release-script with the current tag and uploads it to pypi, at the moment it is v0.8.0. So hopefully replacing this manually will help.

AusDavo commented 4 years ago

Thanks again, Stepan. I made change that you recommended and it appears to have solved the problem. I have built the Snap now but I still have some errors. I think that this is called debugging. I need to take a rest now. After I install the Snap (in devmode), I get the following errors:

david@david-NUC8i5BEK:~/mysnaps/specter-desktop$ specter-desktop
Initializing HWI...
[2020-09-23 20:00:56,128] INFO in __main__: Logging configured
Traceback (most recent call last):
  File "/snap/specter-desktop/x2/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/snap/specter-desktop/x2/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/snap/specter-desktop/x2/lib/python3.6/site-packages/cryptoadvance/specter/__main__.py", line 16, in <module>
    cli()
  File "/snap/specter-desktop/x2/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/snap/specter-desktop/x2/lib/python3.6/site-packages/click/core.py", line 696, in main
    _verify_python3_env()
  File "/snap/specter-desktop/x2/lib/python3.6/site-packages/click/_unicodefun.py", line 124, in _verify_python3_env
    ' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

Click discovered that you exported a UTF-8 locale
but the locale system could not pick up from it because
it does not exist.  The exported locale is "en_AU.UTF-8" but it
is not supported
david@david-NUC8i5BEK:~/mysnaps/specter-desktop$ 

Please, can you see if there is another little thing that I ought to change? I may put my hand up again in the SnapCraft Forum too for help. I'm out of my depth here but happy to try a few more things.

stepansnigirev commented 4 years ago

Looks like you need to set the locale on your PC for that:

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8

Also I am not sure if Specter runs on python3.6, we only tested it on python3.7+, so if you are facing other issues let me know.

k9ert commented 4 years ago

Snap looks interesting and i think on the mid- and longterm, we'll publish snaps as well. I'm also happy to help here but before i'll look into this myself, i'll probably first will hato get a docker-image published.

There are just too man packaging-formats out there ;-).

AusDavo commented 4 years ago

Looks like you need to set the locale on your PC for that:

export LC_ALL=en_US.utf-8
export LANG=en_US.utf-8

Also I am not sure if Specter runs on python3.6, we only tested it on python3.7+, so if you are facing other issues let me know.

Thanks for your suggustion, Stepan. I see that the locale-control interface can be specified in the yaml file, which is a configuration file used for building the snap package. Perhaps providing that interface will help. I'll report back on how it goes.

AusDavo commented 4 years ago

Snap looks interesting and i think on the mid- and longterm, we'll publish snaps as well. I'm also happy to help here but before i'll look into this myself, i'll probably first will hato get a docker-image published.

There are just too man packaging-formats out there ;-).

Thanks, Kim. That would be great. I'm trying to make the snap package but it's slow going for me. A snap package of Specter-Desktop would be great!

Right now, I run Bitcoin Core (distributed as a snap) on a NUC with Ubuntu Core for its OS. It's a neat, minimalist and secure combination. To run Specter-Desktop on the same device, I will need to snap it.

k9ert commented 4 years ago

To run Specter-Desktop on the same device, I will need to snap it.

I was not aware that "Ubuntu Core" can only run with snaps. I just checked the issue and found this on the snapcraft forum: https://forum.snapcraft.io/t/error-could-not-find-a-version/20145/6

apps:
    specter-desktop:
        environment:
            LANG: C.UTF-8
            LC_ALL: C.UTF-8

Does that help you? I guess there is a yaml-file which you had to create in order to create the snaps! Most cumbersome error with yaml-files: Be very careful about the number of spaces to make the indentation. It's 2 spaces each. So in the above example, you need 2 spaces in front of "specter-desktop", 4 in from of environment, 6 at LANG and LC_ALL. Double check that also for the other entries there!

AusDavo commented 4 years ago

Thanks! I made the suggested changes to the yaml and now I can install from the snap and run the program. I see the following:

Initializing HWI...
[2020-09-27 11:51:20,132] INFO in __main__: Logging configured
[2020-09-27 11:51:20,133] INFO in server: Initializing LoginManager
[2020-09-27 11:51:20,133] INFO in server: Initializing LoginManager
[2020-09-27 11:51:20,134] INFO in server: Initializing Specter
[2020-09-27 11:51:20,134] INFO in server: Initializing Specter
[2020-09-27 11:51:20,134] INFO in specter: rpc config have changed.
[2020-09-27 11:51:20,134] INFO in server: Login disabled
[2020-09-27 11:51:20,135] ERROR in version: __init__() got an unexpected keyword argument 'capture_output'
[2020-09-27 11:51:20,134] INFO in server: Login disabled
[2020-09-27 11:51:20,135] INFO in server: Initializing Controller ...
[2020-09-27 11:51:20,135] INFO in version: version checked. upgrade: False
[2020-09-27 11:51:20,135] INFO in server: Initializing Controller ...
Starting server in background...
 * Hopefully running on http://127.0.0.1:25441/

Unfortunately, Firefox can’t establish a connection to the server at 127.0.0.1:25441.

Maybe I need to make sure that the correct command is being used to start Specter-Desktop... In the yaml, I specify:

apps:
  specter-desktop:
    environment:
      LANG: C.UTF-8
      LC_ALL: C.UTF-8
    command: python3 -m cryptoadvance.specter server --daemon

Is this okay?

AusDavo commented 4 years ago

Just a quick note. I removed --daemon from the command in the yaml (and then repackaged and reinstalled the applicatoin) and now I can access the GUI at 127.0.0.1:25441. I wonder why that made a difference.

AusDavo commented 4 years ago

It's a bit of a problem. I want to run this as a daemon. Any ideas on how to do this?

k9ert commented 4 years ago

Ahh, i thought you got the solution. It kind of made sense to me. Ok, here are some hints on how to configure that as a snap: https://snapcraft.io/docs/services-and-daemons

You can use "simple" but then don't append "--daemon". You can use "fork" but then you have to append "daemon". Maybe you want "restart-condition: on-failure". I think it's pretty straightforward and you won't need any of the specific stuff mentioned on the page.

Does that make sense and helps you? Can you post your whole yaml so far?

AusDavo commented 4 years ago

Thanks for taking an interest in this! I'm a real novice. This is the yaml that I have been working on:

name: specter-desktop # you probably want to 'snapcraft register <name>'
base: core18
version: '0.8.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: GUI for Bitcoin Core optimised for using hardware wallets # 79 char long summary
description: |
  An easy bitcoin multi signature wallet that doesn’t require an electrum server.
  Support for different bitcoin hardware wallets and a great interface.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  specter-desktop:
    # See 'snapcraft plugins'
    plugin: python
    stage-packages: 
      - libusb-1.0-0-dev
      - libudev-dev
    source: .

apps:
  specter-desktop:
    environment:
      LANG: C.UTF-8
      LC_ALL: C.UTF-8
    command: python3 -m cryptoadvance.specter server

I've been following along with a guide on YouTube: https://youtu.be/BEp_l2oUcD8

I've installed snappy-debug but I haven't made any changes to the yaml after using it yet.

k9ert commented 4 years ago

Thank you so much, this will definitely help me to get official snaps in place. So the deamon-stuff still don't work, right? At least you have a workaround so far starting it manually.

AusDavo commented 4 years ago

Correct. Without --daemon, I can run it on a different machine (my regular desktop with Ubuntu 18.04.5 LTS) to the node and pass commands to it. The GUI is displayed fine. However, when I transferred the snap that I made to the node machine, it doesn't work. The program stops and I'm not able to use the specter-desktop GUI.

k9ert commented 4 years ago

I think you're really getting very close :-). Check this, i guess you need both: https://snapcraft.io/docs/network-interfaces

Do you want to have access from the outside as well? If not (recomended if you don't use https) you should make sure to bind to the right interface (127.0.0.1). Maybe that's the default. I couldn't figure out how to do that. You can be happy if it's working but you definitely need to know whether it's available from the outside as well!

Update: Ups, i've answered to what i read on my mail. Did you delete a comment or modified it? Please post the complete current state of your yaml again!

AusDavo commented 4 years ago

I added the network plug so the yaml now looks like this:

name: specter-desktop # you probably want to 'snapcraft register <name>'
base: core18
version: '0.8.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: GUI for Bitcoin Core optimised for using hardware wallets # 79 char long summary
description: |
  An easy bitcoin multi signature wallet that doesn’t require an electrum server.
  Support for different bitcoin hardware wallets and a great interface.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  specter-desktop:
    # See 'snapcraft plugins'
    plugin: python
    stage-packages: 
      - libusb-1.0-0-dev
      - libudev-dev
    source: .

apps:
  specter-desktop:
    environment:
      LANG: C.UTF-8
      LC_ALL: C.UTF-8
    command: python3 -m cryptoadvance.specter server
    plugs:
      - network
      - network-bind

I repackaged the snap and transferred it to my NUC. I installed it (--devmode) but it's still not working yet. I even tried adding --host 0.0.0.0 This is the output:

Initializing HWI...
[2020-10-03 21:32:18,720] INFO in __main__: Logging configured
[2020-10-03 21:32:18,726] INFO in server: Initializing LoginManager
[2020-10-03 21:32:18,726] INFO in server: Initializing Specter
[2020-10-03 21:32:18,729] INFO in specter: rpc config have changed.
[2020-10-03 21:32:18,730] ERROR in version: __init__() got an unexpected keyword argument 'capture_output'
[2020-10-03 21:32:18,731] INFO in version: version checked. upgrade: False
[2020-10-03 21:32:18,734] INFO in server: Login disabled
[2020-10-03 21:32:18,734] INFO in server: Initializing Controller ...
 * Serving Flask app "cryptoadvance.specter.server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "/snap/specter-desktop/x1/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/snap/specter-desktop/x1/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/cryptoadvance/specter/__main__.py", line 16, in <module>
    cli()
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/cryptoadvance/specter/cli.py", line 178, in server
    run(debug=debug)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/cryptoadvance/specter/cli.py", line 155, in run
    app.run(debug=debug, **kwargs)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/flask/app.py", line 990, in run
    run_simple(host, port, self, **options)
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 1052, in run_simple
    inner()
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 1005, in inner
    fd=fd,
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 848, in make_server
    host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
  File "/snap/specter-desktop/x1/lib/python3.6/site-packages/werkzeug/serving.py", line 740, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "/snap/specter-desktop/x1/usr/lib/python3.6/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/snap/specter-desktop/x1/usr/lib/python3.6/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/snap/specter-desktop/x1/usr/lib/python3.6/socketserver.py", line 470, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
AusDavo commented 4 years ago

Hey, I think that I did something wrong last time so I tried it all over again. Maybe I left an instance of Specter-Desktop running on the node or something. Anyhow, this time it worked much better! I entered specter-desktop --host 0.0.0.0 and then received the following:

Initializing HWI...
[2020-10-03 21:39:03,967] INFO in __main__: Logging configured
[2020-10-03 21:39:03,973] INFO in server: Initializing LoginManager
[2020-10-03 21:39:03,973] INFO in server: Initializing Specter
[2020-10-03 21:39:03,974] INFO in specter: rpc config have changed.
[2020-10-03 21:39:03,976] ERROR in version: __init__() got an unexpected keyword argument 'capture_output'
[2020-10-03 21:39:03,976] INFO in version: version checked. upgrade: False
[2020-10-03 21:39:03,982] INFO in server: Login disabled
[2020-10-03 21:39:03,982] INFO in server: Initializing Controller ...
 * Serving Flask app "cryptoadvance.specter.server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off

From my desktop, I entered http://192.168.2.7:25441 in the browser the GUI appeared! It doesn't see the node yet but perhaps that can be achieved by changing some settings in the GUI.

AusDavo commented 4 years ago

Hey, it's working quite nicely now! In the tutorial that I was following for creating snaps, I see that there are still a few more steps to go. I installed the snap with --devmode appended and that will need to change. I'll keep chipping away at it and report again soon. Thanks for the advice and for the encouragement!

AusDavo commented 4 years ago

I changed the confinement mode in the yaml to strict. I repacked the snap on this basis and then installed and executed it. I ran snappy-debug in the background to look for any confinement issues. I added every plug that was suggested to the yaml. Here's a copy:

name: specter-desktop # you probably want to 'snapcraft register <name>'
base: core18
version: '0.8.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: GUI for Bitcoin Core optimised for using hardware wallets # 79 char long summary
description: |
  An easy bitcoin multi signature wallet that doesn’t require an electrum server.
  Support for different bitcoin hardware wallets and a great interface.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

parts:
  specter-desktop:
    # See 'snapcraft plugins'
    plugin: python
    stage-packages: 
      - libusb-1.0-0-dev
      - libudev-dev
    source: .

apps:
  specter-desktop:
    environment:
      LANG: C.UTF-8
      LC_ALL: C.UTF-8
    command: python3 -m cryptoadvance.specter server
    plugs:
      - network
      - network-bind
      - home
      - mount-observe
      - network-control
      - account-control
      - audio-playback
      - bluetooth-control
      - firewall-control
      - hardware-observe
      - netlink-audit
      - netlink-connector
      - network-observe
      - raw-usb
      - time-control
      - unity7
      - upower-observe
      - x11
      - camera

I repackaged the snap and then installed it again (now using --dangerous) and executed it. It runs fine! I see that it still gives some confinement warnings in snappy-debug. Perhaps adding all of those plugs didn't do much? I'll share the output from snappy-debug that relates to Specter-Desktop:

= AppArmor =
Time: Oct 05 12:22:38
Log: apparmor="DENIED" operation="open" profile="snap.specter-desktop.specter-desktop" name="/home/8voe6u/snap/" pid=3270 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /home/8voe6u/snap/ (read)
Suggestions:
* adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
* add 'home' to 'plugs'

= AppArmor =
Time: Oct 05 12:22:38
Log: apparmor="DENIED" operation="open" profile="snap.specter-desktop.specter-desktop" name="/proc/3270/mounts" pid=3270 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /proc/3270/mounts (read)
Suggestions:
* adjust program to not access '@{PROC}/@{pid}/mounts'
* add one of 'mount-observe, network-control' to 'plugs'

= AppArmor =
Time: Oct 05 12:22:42
Log: apparmor="DENIED" operation="open" profile="snap.specter-desktop.specter-desktop" name="/home/8voe6u/snap/" pid=3270 comm="python3" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
File: /home/8voe6u/snap/ (read)
Suggestions:
* adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
* add 'home' to 'plugs'

= Seccomp =
Time: Oct 05 12:22:42
Log: auid=1000 uid=1000 gid=1000 ses=5 pid=3270 comm="python3" exe="/snap/specter-desktop/x1/usr/bin/python3.6" sig=0 arch=c000003e 41(socket) compat=0 ip=0x7fef46385077 code=0x50000
Syscall: socket
Suggestions:
* add account-control (if using NETLINK_AUDIT)
* add audio-playback (if using NETLINK_KOBJECT_UEVENT)
* add bluetooth-control (if using AF_{ALG,BLUETOOTH})
* add firewall-control (if using NETLINK_{FIREWALL,IP6_FW,NETFILTER,NF_LOG,ROUTE})
* add hardware-observe (if using NETLINK_{GENERIC,KOBJECT_UEVENT})
* add netlink-audit (if using NETLINK_AUDIT)
* add netlink-connector (if using NETLINK_CONNECTOR)
* add network (if using AF_INET{,6}, AF_CONN, NETLINK_ROUTE)
* add network-bind (if using AF_INET{,6}, NETLINK_ROUTE)
* add network-control (if using AF_{APPLETALK,BRIDGE,INET,INET6,IPX,PACKET,PPPOX,SNA}, NETLINK_{DNRTMSG,FIB_LOOKUP,GENERIC,INET_DIAG,ISCSI,KOBJECT_UEVENT,RDMA,ROUTE,XFRM})
* add network-observe (if using SOCK_RAW, AF_INET{,6}), NETLINK_{GENERIC,INET_DIAG,KOBJECT_UEVENT,ROUTE})
* add raw-usb (if using NETLINK_KOBJECT_UEVENT)
* add time-control (if using NETLINK_AUDIT)
* add upower-observe (if using NETLINK_KOBJECT_UEVENT)
* add x11 (if using NETLINK_KOBJECT_UEVENT)

I'm very happy that the program is working from a snap! I have it installed on my node that uses Ubuntu Core for the operating system and I can reach it from other devices on the same network. It would be nice to make the snap package available to everyone. I'll look into what will need to be done to make the package acceptable to Canonical for inclusion in their store. I think that they prefer that apps are well-confined. Perhaps it will be necessary to pare back the list of plugs in the yaml.

AusDavo commented 4 years ago

What do you think is the best way to proceed? Would you like me to send a copy of the snap file? Shall I add it here, on git-hub? I'm a novice but I'm willing to try.

AusDavo commented 3 years ago

I could try and get the Snap added to the Snapstore? Or would you prefer to try this?

k9ert commented 3 years ago

Sorry for the late reply. Thank you very much for your work!

What do you think is the best way to proceed?

Usually, the problem is to get a recent version, not only one version. Therefore we need to find a way to integrate the snap integration into the automated-release-process. So it's fine to e.g. upload the snap somewhere and make it available for others to be installed but i don't think that many will do that. Before we have a snap from cryptoadvance, it would definitely be a huge benefit for the people to read a "howto get specter work on Ubuntu Core" and explain them how they can themself create the snap. That would also be beneficial to me in order to automate the creation of the snap as part of the build-process.

Are you interested in writing such a howto? If not, maybe you can put some links in here and write a brief comment which summarizes what needs to be done in a very brief way? I'm happy with anything, no matter how brief.

I'd suggest to keep this issue open until i've automated the creation of snaps (which we'll then upload to snapcraft). Btw, docker-images are done, so i'm happy to do that next!

AusDavo commented 3 years ago

Hi, Kim. Thanks for the info. I'll document the steps that I used for getting Specter Desktop into a Snap package and then running on Ubuntu Core. I'm a novice but I'll have a go at making a short guide. So much the better if it helps you get a package onto Snapcraft! I will hope to find the time this weekend.

On Mon, 12 Oct 2020, at 1:59 AM, Kim Neunert wrote:

Sorry for the late reply. Thank you very much for your work!

What do you think is the best way to proceed?

Usually, the problem is to get a recent version, not only one version. Therefore we need to find a way to integrate the snap integration into the automated-release-process. So it's fine to e.g. upload the snap somewhere and make it available for others to be installed but i don't think that many will do that. Before we have a snap from cryptoadvance, it would definitely be a huge benefit for the people to read a "howto get specter work on Ubuntu Core" and explain them how they can themself create the snap. That would also be beneficial to me in order to automate the creation of the snap as part of the build-process.

Are you interested in writing such a howto? If not, maybe you can put some links in here and write a brief comment which summarizes what needs to be done in a very brief way? I'm happy with anything, no matter how brief.

I'd suggest to keep this issue open until i've automated the creation of snaps (which we'll then upload to snapcraft). Btw, docker-images are done, so i'm happy to do that next!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cryptoadvance/specter-desktop/issues/412#issuecomment-706726092, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFTZQMT7L6EX3Y3BJZIRT3SKHI57ANCNFSM4RTLZFVA.

k9ert commented 3 years ago

Don't be too precise with that. I'm used to work myself through that with bits and pieces. At least i'd prefer the central file (it's only one yaml-file, right) with no explanation over a perfect tutorial in 3 month :-).

AusDavo commented 3 years ago

Okay. That simplifies things! Thanks for working on adding support for the Snap package. Here is the yaml (snapcraft.yaml) that I used. I added every plug suggested by snappy-debug. Perhaps not all are strictly necessary.

name: specter-desktop # you probably want to 'snapcraft register <name>'
base: core18
version: '0.8.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: GUI for Bitcoin Core optimised for using hardware wallets # 79 char long summary
description: |
  An easy bitcoin multi signature wallet that doesn’t require an electrum server.
  Support for different bitcoin hardware wallets and a great interface.

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

parts:
  specter-desktop:
    # See 'snapcraft plugins'
    plugin: python
    stage-packages: 
      - libusb-1.0-0-dev
      - libudev-dev
    source: .

apps:
  specter-desktop:
    environment:
      LANG: C.UTF-8
      LC_ALL: C.UTF-8
    command: python3 -m cryptoadvance.specter server
    plugs:
      - network
      - network-bind
      - home
      - mount-observe
      - network-control
      - account-control
      - audio-playback
      - bluetooth-control
      - firewall-control
      - hardware-observe
      - netlink-audit
      - netlink-connector
      - network-observe
      - raw-usb
      - time-control
      - unity7
      - upower-observe
      - x11
      - camera

I followed a guide that Snapcraft published on YouTube last year: Snapcraft Live - A beginner's guide to building snaps I'm very happy to discuss the process that I followed. Ask anything. I really like Specter-Desktop. Very happy with it running alongside Bitcoin Core on my Ubuntu Core node. I've set up VPN access to my local network so that I can access the GUI from anywhere now.

AusDavo commented 3 years ago

I'd like to install to the latest version of Specter-Desktop by snap. Please, have you had any time to work on releases in this format? I tried to make a new snap from the latest release but I couldn't get it to work.

k9ert commented 3 years ago

I looked into creating snaps and tried to recreate a snap, had issues with creating the snap with the above yml. Adding this helped:

    stage-packages: 
      - libusb-1.0-0-dev
      - libudev-dev

However, i aslo realized that this snap is only creating a snap of a specterd. However what most people probably would expect from a specter-snap is more the electron-app than a specterd: The full experience of a local app as easily installable than a snap.

Unfortunately i don't have the time to create that sort of snap but the dump-plugin mentioned later in the video is probably what is needed here.

AusDavo commented 3 years ago

Thanks for taking the time to try this.

k9ert commented 3 years ago

Well, thanks for doing all the work in the first place :-). I think the main issue for us now is, that we we're a small team and don't have the capacity to support all these "publication-channels": Windows, Mac, Linux, pip-packages. For heaven sake at least docker-images (again for several platforms arm/amd...) are no longer done by us directly. This is especially also a problem with frequent releases. It gets mitigates with automation but automation only takes you so far and it's also stuff which needs to get maintained and troubleshooted.

Anyway, long story short: If anyone is interested in taking over stuff like that ... you're more then welcome!

nolim1t commented 3 years ago

I think its a valid issue, but given the nature of open source it doesn't have to be done by "core members".

Anyone can grab the code and automate it themselves, like I have done and many people are using it, including Umbrel