Coder Social home page Coder Social logo

Comments (25)

theolampert avatar theolampert commented on May 9, 2024 13

Hi all, for anyone new coming to this issue I got this working by following @Pierstoval and others in this thread. To recap (I can also add a note to the readme if it helps):

// Get the code
$ git clone https://github.com/usefathom/fathom.git
$ cd fathom

// Create a new heroku app
$ heroku create

//Push the fathom container to heroku's registry
$ heroku container:push web

//Release the container
$ heroku container:release web

//Configure fathon to use msql and a secret
$ heroku config:set FATHOM_DATABASE_DRIVER=mysql FATHOM_SECRET=whateverGeneratedSecretYouWantToUse

//Create a new mysql database
$ heroku addons:create jawsdb:kitefin

//Get the mysql connection url
$ heroku config:get JAWSDB_URL
//mysql://user:password@host:3306/database_name

//Set database variables from the above url
$ heroku config:set FATHOM_DATABASE_NAME=database_name FATHOM_DATABASE_USER="user" FATHOM_DATABASE_PASSWORD="password" FATHOM_DATABASE_HOST="host:3306"

//Register a new user
$ heroku run ./fathom register [email protected] --password='yourpassword'

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024 3

I suggest to add this to the Wiki & add a link in the README to make sure everyone can create a Heroku project easily just to host a Fathom app 😄

from fathom.

jdsimcoe avatar jdsimcoe commented on May 9, 2024 2

Thanks so much, @dannyvankooten! This worked fabulously.

from fathom.

davidyeiser avatar davidyeiser commented on May 9, 2024 2

@aleccool213 I got the same error using the latest files on master. I switched to the 1.2.1 release and it worked fine.

Also, if you get the error below when you run heroku container:push web

no basic auth credentials
 ▸    Error: docker push exited with Error: 1

Run heroku container:login and that should fix it.

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024 1

Have you tried to fork the project & make it your git root on Heroku? I'm not sure with Go apps, but setting up an application seems quite straightforward:

https://devcenter.heroku.com/articles/deploying-go

But of course setting it up with default Fathom repository could be nice too 😄

from fathom.

dannyvankooten avatar dannyvankooten commented on May 9, 2024 1

Hey @JDsnyke,

I don't actually have any experience with Heroku myself but I'll dive into their docs tomorrow to see how we can make deploying to Heroku easier (or whether anything is even needed to make the two compatible).

From a quick glance at their docs, it seems you can push the official Docker image to the Heroku Container Registory.

from fathom.

lovethebomb avatar lovethebomb commented on May 9, 2024 1

@dannyvankooten Maybe this could be solved by using the env var cascading definition?

https://github.com/urfave/cli#values-from-the-environment

Which would be in fathom/main.go:

cli.StringFlag{
	EnvVar: "FATHOM_SERVER_ADDR,PORT",
	Name:   "addr,port",
	Usage:  "server address",
	Value:  ":8080",
},

from fathom.

dannyvankooten avatar dannyvankooten commented on May 9, 2024 1

Hey, glad you got it working and thanks for sharing the info here. That helps!

I'll be closing this issue while linking to it from the wiki.

from fathom.

dannyvankooten avatar dannyvankooten commented on May 9, 2024 1

Hi @jdsimcoe,

That is most likely because you didn't add a user account to your Fathom dashboard, effectively making it a "public" dashboard. Right now public dashboards don't show the site switcher dropdown until we work in more advanced user management (with roles), but you should be able to add a user, add your sites and then delete your user again to track multiple sites in a public dashboard.

Example:

fathom user add [email protected] --password='super-strong-password'

Then, login to your Fathom dashboard via the web interface and add your additional sites.

To make the dashboard public again, delete the user account when you're done adding your sites.

fathom user delete [email protected]

from fathom.

gmolveau avatar gmolveau commented on May 9, 2024 1

Hi ! I made a tutorialon how to deploy on heroku if anyone's interested.

https://gist.github.com/gmolveau/78f88af3f5951ba6e093f93a07caa302

from fathom.

gmolveau avatar gmolveau commented on May 9, 2024 1

@Pierstoval okay I'll make one. I have another one for clever-cloud.com too.

from fathom.

smobbl-bobbl avatar smobbl-bobbl commented on May 9, 2024

any news here? am excited to try fathom on heroku as well!

from fathom.

prologic avatar prologic commented on May 9, 2024

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

I made a few tests, and what I struggle with, mostly:

  • With Docker, I don't know how to use the port that is provided by Heroku's proxy through the PORT env var, but apart that, setup is easy:

    Run these commands to start the project:

    $ git clone [email protected]:usefathom/fathom.git
    $ cd fathom
    $ heroku create
    $ heroku stack:set container
    $ heroku config:set FATHOM_DEBUG=false FATHOM_DATABASE_DRIVER=mysql FATHOM_SECRET=whateverGeneratedSecretYouWantToUse
    $ heroku addons:create jawsdb:kitefin
    

    Retrieve the database url from JawsDB's config:

    $ heroku config:get JAWSDB_URL
    mysql://user:password@host:3306/database_name
    

    Fetch all information and add the config so Fathom can use it:

    $ heroku config:set FATHOM_DATABASE_NAME=database_name FATHOM_DATABASE_USER="user" FATHOM_DATABASE_PASSWORD="password" FATHOM_DATABASE_HOST="host:3306"
    
  • Without Docker, I don't really know how to build fathom, but if I figure out how to do it when deploying, it's easy to just build the binary at deploy-time and just execute fathom via a Procfile. Any idea on this?

from fathom.

lovethebomb avatar lovethebomb commented on May 9, 2024

I do not have a Heroku account under hand but try setting the env variable FATHOM_SERVER_ADDR , default is :8080.

Maybe something like this would work, using $PORT from Heroku env:

heroku config:set FATHOM_SERVER_ADDR=":$PORT"

Mind the : colon!

Default port in fathom/main.go:47-50

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

@lovethebomb this solution doesn't work because $PORT must be resolved at deploy time, which is not the case.

I don't know Go, but I think there might be a way to parse every $... instruction in env vars values to resolve them based on env vars, is this even possible?

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

@theolampert I just tried and it doesn't work, probably because of the PORT issue 😕

Edit: Nevermind, I forgot to upgrade my repository with the latest commits from master 😆 🤣

from fathom.

theolampert avatar theolampert commented on May 9, 2024

@Pierstoval I managed to get it running, I think you need to remove any reference to PORT or FATHOM_SERVER_ADDR in your heroku config, afaik this commit c437f8a should make fathon use heroku's PORT environmental variable.

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

Yep, I edited my comment, it's actually working well :)

from fathom.

theolampert avatar theolampert commented on May 9, 2024

@Pierstoval glad to hear it!, @dannyvankooten maybe we could close this and add a note somewhere?.

from fathom.

jdsimcoe avatar jdsimcoe commented on May 9, 2024

@theolampert Thanks for the instructions! They worked marvelously. Once my Heroku instance is up I can't find a way to add multiple sites. Once I've added a site, the dialog and UI in the upper right goes away.

from fathom.

aleccool213 avatar aleccool213 commented on May 9, 2024

getting this error when I run heroku container:push web :

=== Building web (/Users/alecbrunelle/github/fathom/Dockerfile)
Sending build context to Docker daemon  35.02MB
Step 1/18 : FROM node:alpine AS assetbuilder
alpine: Pulling from library/node
169185f82c45: Pull complete
80e1b3e484f0: Pull complete
93e33f1be740: Pull complete
Digest: sha256:175109ea9ade024a2851a8847b04e67860e58c757ba66d15a4cd057749018b46
Status: Downloaded newer image for node:alpine
 ---> ebbf98230a82
Step 2/18 : WORKDIR /app
 ---> Running in 613dfacb3a25
Removing intermediate container 613dfacb3a25
 ---> b0e3f4365c1d
Step 3/18 : COPY package*.json ./
 ---> 0897a39b3f49
Step 4/18 : COPY gulpfile.js ./
 ---> 8ec981a64aba
Step 5/18 : COPY assets/ ./assets/
 ---> 502452d5afb6
Step 6/18 : RUN npm install && NODE_ENV=production ./node_modules/gulp/bin/gulp.js
 ---> Running in d03fc86538d6

> [email protected] postinstall /app/node_modules/preact
> node -e "console.log('\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[0m')"

Love Preact? You can now donate to our open collective:
 > https://opencollective.com/preact/donate
npm WARN app No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 667 packages from 380 contributors and audited 8105 packages in 14.552s
found 3 vulnerabilities (1 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
[14:55:48] Using gulpfile /app/gulpfile.js
[14:55:48] Starting 'default'...
[14:55:48] Starting 'app-js'...
[14:55:56] Finished 'app-js' after 8.72 s
[14:55:56] Starting 'tracker-js'...
[14:55:57] Finished 'tracker-js' after 119 ms
[14:55:57] Starting 'css'...
[14:55:57] Finished 'css' after 7.79 ms
[14:55:57] Starting 'html'...
[14:55:57] Finished 'html' after 22 ms
[14:55:57] Starting 'img'...
[14:55:57] Finished 'img' after 5.26 ms
[14:55:57] Starting 'fonts'...
[14:55:57] Finished 'fonts' after 94 ms
[14:55:57] Finished 'default' after 8.98 s
Removing intermediate container d03fc86538d6
 ---> 6ef28fd8e3c0
Step 7/18 : FROM golang:latest AS binarybuilder
latest: Pulling from library/golang
ab1fc7e4bf91: Already exists
35fba333ff52: Already exists
f0cb1fa13079: Already exists
3d1dd648b5ad: Already exists
866ed2e2b1fe: Pull complete
ddc4ad35a2f0: Pull complete
ab8da8d8889d: Pull complete
Digest: sha256:6486ea568f95953b86c9687c1e656f4297d9b844481e645a00c0602f26fee136
Status: Downloaded newer image for golang:latest
 ---> 5049ec6e3141
Step 8/18 : WORKDIR /go/src/github.com/usefathom/fathom
 ---> Running in 5e406992fff3
Removing intermediate container 5e406992fff3
 ---> db3862e1cef0
Step 9/18 : COPY . /go/src/github.com/usefathom/fathom
 ---> 7cde2bde71ce
Step 10/18 : COPY --from=assetbuilder /app/assets/build ./assets/build
 ---> 2e1ee9393d83
Step 11/18 : RUN make docker
 ---> Running in aa4d880ac0ae
GOOS=linux GOARCH=amd64 /go/bin/packr build -v -ldflags '-w -extldflags "-static" -X "main.version=1.2.1+18-g05598eb" -X "main.commit=05598eb1317d703052b26a087f1acd7c03ca4435"  -X "main.date="' -o fathom ./main.go
/bin/sh: 1: /go/bin/packr: not found
make: *** [docker] Error 127
Makefile:20: recipe for target 'docker' failed
The command '/bin/sh -c make docker' returned a non-zero code: 2
 ▸    Error: docker build exited with Error: 2

from fathom.

aleccool213 avatar aleccool213 commented on May 9, 2024

@davidyeiser Thank you so much! 😃

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

Great!

@gmolveau Can you submit a PR to add a documentation section explaining this? 😄

from fathom.

Pierstoval avatar Pierstoval commented on May 9, 2024

Awesome! 👍

from fathom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.