# IPFS Start ipfs daemon direct from the go application

**URL:** <https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952>\
**Category:** Kubo\
**Tags:** go-ipfs\
**Created:** [February 28, 2019, 9:47pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952 "2019-02-28T21:47:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dserna](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/dserna/32/2324_2.png) [@dserna](https://discuss.ipfs.tech/u/dserna)\
**Post date:** [February 28, 2019, 9:47pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/1 "2019-02-28T21:47:27Z")

</div>

Hi everyone

I am developing an application in Go that uses IPFS to add files and to send messages through pubsub feature.  
I would like to start the daemon directly from the go application. I had tried calling a bash file with the following commands

_if [! -e ${HOME}/.ipfs/api]_  
_then_  
\_ ipfs daemon --enable-pubsub-experiment &\_  
_else_  
\_ echo “IPFS already started”\_  
_fi_  
_while [! -e ${HOME}/.ipfs/api]_  
_do_  
\_ echo “Waiting for IPFS to start”;\_  
\_ sleep 1\_  
_done_

but it had not working.

Someone know a library that I can use in go to start the daemon directly from the application?

Thanks in advance  
Diana

---

<div class="post-metadata">

**Author:** ![stefanhans65](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stefanhans65/32/1466_2.png) [@stefanhans65](https://discuss.ipfs.tech/u/stefanhans65)\
**Post date:** [March 6, 2019, 12:39pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/2 "2019-03-06T12:39:04Z")

</div>

Hi @dserna,

I’m interested in this question as well.

My current approach is to understand _go-ipfs/cmd/ipfs_ which “implements the primary CLI binary for ipfs.”

There should be a way to starting the daemon, i.e., the API server. 😀

Tomorrow I will work on it and post my findings.

Cu, Stefan

---

<div class="post-metadata">

**Author:** ![stefanhans65](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stefanhans65/32/1466_2.png) [@stefanhans65](https://discuss.ipfs.tech/u/stefanhans65)\
**Post date:** [March 7, 2019, 12:12pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/3 "2019-03-07T12:12:20Z")

</div>

Hi @dserna,

I did it. Have a look [https://github.com/stefanhans/go-ipfs-play/tree/master/daemon](https://github.com/stefanhans/go-ipfs-play/tree/master/daemon)

My next approach will be to import `"syscall"` and use it to check for `ipfs daemon`

cu, Stefan

---

<div class="post-metadata">

**Author:** ![stefanhans65](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stefanhans65/32/1466_2.png) [@stefanhans65](https://discuss.ipfs.tech/u/stefanhans65)\
**Post date:** [March 7, 2019, 6:25pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/4 "2019-03-07T18:25:36Z")

</div>

Have a look [https://github.com/stefanhans/go-ipfs-play/tree/master/ipfs-daemon-start](https://github.com/stefanhans/go-ipfs-play/tree/master/ipfs-daemon-start)

---

<div class="post-metadata">

**Author:** ![dserna](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/dserna/32/2324_2.png) [@dserna](https://discuss.ipfs.tech/u/dserna)\
**Post date:** [March 11, 2019, 9:30pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/5 "2019-03-11T21:30:58Z")

</div>

Hi @stefanhans65

Thanks a lot 🤗  
I had tested the example [https://github.com/stefanhans/go-ipfs-play/tree/master/ipfs-daemon-start](https://github.com/stefanhans/go-ipfs-play/tree/master/ipfs-daemon-start)  
and it works perfect, I had modified the line 19 to:  
cmd.Args = []string{“ipfs”, “daemon”, “–enable-pubsub-experiment”}  
because I am working with the experimental feature pubsub and it works fine…

I had also find one example to start the ipfs daemon using the syscall (for Raspbian Stretch, Ubuntu 15.04 and newer, CentOS 7 and newer):

> <https://github.com/claudiobizzotto/ipfs-rpi/blob/master/templates/ipfs-daemon.service.tpl>

  
\*\* Note: you will need to change the line Environment=IPFS\_PATH={{ipfs\_path}} with you enviroment path

I had used it to start the ipfs daemon by boot in a raspberry and beaglebone and it works fine.

Thanks again for your help

Diana

---

<div class="post-metadata">

**Author:** ![stefanhans65](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stefanhans65/32/1466_2.png) [@stefanhans65](https://discuss.ipfs.tech/u/stefanhans65)\
**Post date:** [March 12, 2019, 8:00am UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/6 "2019-03-12T08:00:52Z")

</div>

Hi @dserna,

you are very welcome 😀

BTW: What API do you use? I’m playing around with these two currently:

> **[ipfs/interface-go-ipfs-core](https://github.com/ipfs/interface-go-ipfs-core)**
>
> Contribute to ipfs/interface-go-ipfs-core development by creating an account on GitHub.

  

> **[ipfs/go-ipfs-api](https://github.com/ipfs/go-ipfs-api)**
>
> The go interface to ipfs's HTTP API. Contribute to ipfs/go-ipfs-api development by creating an account on GitHub.

Cheers, Stefan

👋 Found out you are using ‘go-ipfs-api.’ The ‘unofficial’ in the README title makes me consider the ‘interface-go-ipfs-core.’ 🤔

---

<div class="post-metadata">

**Author:** ![dserna](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/dserna/32/2324_2.png) [@dserna](https://discuss.ipfs.tech/u/dserna)\
**Post date:** [March 12, 2019, 7:17pm UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/7 "2019-03-12T19:17:03Z")

</div>

Hi @stefanhans65

I had installed go-ipfs, since I am using different machines I had installed the go-ipfs v0.4.19 linux binary arm (for an arm machine with linux), the bare bones IPFS installer for Raspberry from claudiobizzotto and updated it to the version 0.4.19

I have written some applications in Go to work with IPFS and they are using the go-ipfs-api, but I guess after to read the README I will try with the interface-go-ipfs-core 🙄

about the ipfs-daemon.service.tpl  
you should create this file in the folder /lib/systemd/system  
to enable you can use the following command: systemctl enable ipfs-daemon

systemctl {disable|status|start|stop} ipfs-daemon

Liebe Grüße  
Diana

---

<div class="post-metadata">

**Author:** ![stefanhans65](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/stefanhans65/32/1466_2.png) [@stefanhans65](https://discuss.ipfs.tech/u/stefanhans65)\
**Post date:** [March 13, 2019, 6:54am UTC](https://discuss.ipfs.tech/t/ipfs-start-ipfs-daemon-direct-from-the-go-application/4952/8 "2019-03-13T06:54:50Z")

</div>

Hi @dserna,

you’ve probably seen my posting

> [@Learn to use IPFS with Go](https://discuss.ipfs.tech/t/learn-to-use-ipfs-with-go/5010):
>
> Hi there, I’ve played around a bit with IPFS using Go, and I’m asking for advice finding the right way. First of all, I’m not afraid of a deep dive and willing to contribute. Here the possibilities I see at the moment: [go-ipfs-api](https://github.com/ipfs/go-ipfs-api)go-ipfs/core/coreapi[interface-go-ipfs-core](https://github.com/ipfs/interface-go-ipfs-core)[go-ipfs-cmds](https://github.com/ipfs/go-ipfs-cmds)[go-ipfs-cmdkit](https://github.com/ipfs/go-ipfs-cmdkit) go-ipfs-api: “An unofficial go interface to ipfs’s HTTP API” - of course, unofficial let me hesitate, and I see two ways using it one by Shell and one by RequestBuilder. The not existing “sh…

Let’s see 😀

Liebe Grüße aus München

Stefan
