Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 16:12
    olivierlacan commented #183
  • 14:32
    djrobby opened #1039
  • 09:14
    mnhattt starred hanami/hanami
  • Apr 04 16:44
    xTunqki starred hanami/hanami
  • Apr 04 15:08
    rodolfobandeira starred hanami/hanami
  • Apr 04 03:27
    marksiemers starred hanami/hanami
  • Apr 03 23:34
    iwatakeshi starred hanami/hanami
  • Apr 03 21:54
    jatanton starred hanami/hanami
  • Apr 03 09:22
    timriley commented #1032
  • Apr 03 09:17
    timriley commented #1032
  • Apr 03 07:27
    jodosha commented #1032
  • Apr 03 07:25
    jodosha review_requested #1032
  • Apr 03 07:19
    jodosha synchronize #1032
  • Apr 03 07:19

    jodosha on hanami-router-2-alpha2

    `Hanami::Application::Router` t… (compare)

  • Apr 03 06:29
    jodosha synchronize #1032
  • Apr 03 06:29

    jodosha on hanami-router-2-alpha2

    `Hanami::Application::Routing::… (compare)

  • Apr 03 06:23
    jodosha synchronize #1032
  • Apr 03 06:23

    jodosha on hanami-router-2-alpha2

    `Hanami::Application::Routing::… (compare)

  • Apr 03 06:15
    jodosha synchronize #1032
  • Apr 03 06:15

    jodosha on hanami-router-2-alpha2

    `Hanami::Configuration#router_*… (compare)

Jeff Dickey
@jdickey
@kaikuchn I've put the two pipeline configs up at https://gist.github.com/jdickey/0bd4113e018befb97d62bf7db369bb5b
  • docker-build.yml is the one that's failing; it runs after semaphore.yml;
  • semaphore.yml runs CI tests against a non-Dockerised copy of the app
Kai Kuchenbecker
@kaikuchn
So you try to setup the database when building the Docker image. Is that right?
Also, I don't see you specifying the DATABASE_URL in the docker-build.yml?
Jeff Dickey
@jdickey
Yes; before I started using Semaphore, I'd built images locally using a close variant of the current Dockerfile and had essentially followed the docs for setting up DATABASE_URL and the other variables in the .env files
No, it's in the Dockerfile, which really should be in that Gist. Hang on and I'll add it
Updated; Gist ordering means it's now the second file in the Gist
Kai Kuchenbecker
@kaikuchn
Why aren't you preparing the DB when starting the container instead of when building it?
The DB isn't part of the image, so there's no use of running it during build time unless you're never leaving that context (i.e., you build where you run).
Jeff Dickey
@jdickey
Good question; I don't really have an answer for that beyond "it worked the first time (locally)"
Kai Kuchenbecker
@kaikuchn
Yeah, because it's the same context. But you really should write an entrypoint.sh script instead and do that there.
Jeff Dickey
@jdickey
true, it's not part of the image (and d'oh!). Yeah, and entrypoint.sh makes sense; always be learning. Thanks; I think I've got enough ammo for the next footgun :D
Kai Kuchenbecker
@kaikuchn
Here's a basic one:
#!/bin/bash

set -Eeuo pipefail

# do stuff

exec "$@"
Jeff Dickey
@jdickey
right; I'll figure out the 'do stuff'. Thanks again
Kai Kuchenbecker
@kaikuchn
That's basically line 21 and 22 in your dockerfile.
don't forget to add ENTRYPOINT ["/docker-entrypoint.sh"] after adding the script. Otherwise he'll just execute command without passing it to your script.
I guess I'd then add a different step to your pipeline (i.e., another yml file?) where you use the built image to run your tests, or whatever you wanted to do, by specifying it in the containers section.
Jeff Dickey
@jdickey
Right; that's in the plan but I was just trying to recreate my deploy-to-k8s-from-locally-built-crap flow first. Running staging-level tests is in the plan. I'm almost getting buyers' remorse from taking on all this docker+k8s+dog-knows-what for a small team; we're not Google scale, but we have had problems matching environments when hand-deploying
there's a ginormous market opportunity for whoever finds the sensible middle ground on this
Kai Kuchenbecker
@kaikuchn
Yeah, I feel ya. k8s is awesome once everythings running. But getting there in a reproducible manner takes time.
Jeff Dickey
@jdickey
I first learned CI/CD when I was part of a large-ish company (150+ devs, 50+ dedicated ops people) and we had single-button deploys; I just misunderestimated how much work it took for one or two folks to get there
Thanks again
Kai Kuchenbecker
@kaikuchn
Oh one other thing you could try is adding --network bridge to the docker build call.

The docker docs are a little thin on this flag.. API 1.25 says

Sets the networking mode for the run commands during build. Supported standard values are: bridge, host, none, and container:<name|id>. Any other value is taken as a custom network's name to which this container should connect to.

docker build --help says

--network string Set the networking mode for the RUN instructions during build (default "default")

Jeff Dickey
@jdickey
yeah, that makes sense, too, and it's a cheap thrill. But I thought bridge was the default
Kai Kuchenbecker
@kaikuchn
So maybe bridge which I'd have thought was the default, isn't?
Jeff Dickey
@jdickey
oops; nope; I'll give it a try
Kai Kuchenbecker
@kaikuchn
My guess is that the docs are wrong and bridge is actually the default..
Otherwise how can you pull packages etc?
A sanity check I like to perform when I cannot establish a connection is this:
service="0.0.0.0/5432"; (timeout 1 bash -c "cat < /dev/null > /dev/tcp/$service" && echo "Success opening remote port") || echo "Could not connect"
This just checks whether a port is open without needing to install special networking tools.
Jeff Dickey
@jdickey
Right; that's a good one. I'll swipe that :grinning:
Sebastjan Hribar
@sebastjan-hribar

We're currently setting up the internationalization project wide and I found these resources: https://www.bounga.org/ruby/2016/10/08/using-i18n-with-hanami/ and https://github.com/ippachi/hanami-i18n

Since there is still no updates hanami/hanami#610 we'll go with the above gem. Can we tie the locale to a setting entity so admins could change the locale per each end user company?

Jeff Dickey
@jdickey
@kaikuchn Well, --network bridge had no discernible effect; on to the entrypoint
Kai Kuchenbecker
@kaikuchn
@jdickey who knows how semaphore makes the service available to you, probably service endpoints just aren't accessible for the docker daemon.. So entrypoint is a good way to just not fight that particular battle.
Jeff Dickey
@jdickey
Makes sense; I'll give it a try and ping their support if I don't get it in a day or so. Thanks for all your help
Kai Kuchenbecker
@kaikuchn
Good luck. Always happy to help.
Paweł Świątkowski
@katafrakt
@sebastjan-hribar I guess you need to set appropriate I18n.locale = locale_from_setting before every action, but it's definitely doable.
kristjan-brezovnik
@kristjan-brezovnik
Hi! I'm completely new to Hanami and basically only style the frontend. To that effect, I would like to use the LESS preprocessor. I've looked though the manuals, but can't seem to figure out what exactly I'm doing wrong. In my 'app/testapp' folder I have downloaded the 'less.js' file and put it under 'assets/javascripts' and in my 'styles.css.less' stylesheet (under 'assets/stylesheets') I put a very simple #header{font-weight: bolder;} declaration to test it. I've also added <link rel="stylesheet/less" type="text/css" href="styles.css.less" /> and <script src="less.js"></script> tags to the app's 'application.html.erb' file. The style is not applied, so now I'm a bit lost. Anyone have any experience with LESS or can point me in the right direction? I could work with SASS or SCSS, if it's easier.
Sebastjan Hribar
@sebastjan-hribar
@katafrakt thank you, will try that. Will have to rethink the use case though if it's worth implementing, since it would effectively not be changed often is at all for one end user. Might as well make the config before deploy.
Sebastjan Hribar
@sebastjan-hribar
@katafrakt On a second note if we setup an AJAX call to a language selector on the UI then users could also make adhoc locale changes, provided we set locale before each action.
Ivan Rubanovskiy
@xvonabur
Hi! Does Hanami supports composite keys in hanami-model? I saw old issue on GitHub, but it's 2 years old: hanami/model#432
Kai Kuchenbecker
@kaikuchn
Folks, I just learned that Ruby 2.7 preview has Enumerator.produce and I'm loving it. Why isn't there more noise about this absolutely fantastic (experimental) addition to Ruby? Check it out
With this I'll never have to write a while loop again x)
Matt
@matt-from-toronto
i just took a look through the guide, hanami looks frickin awesome. congrats all! really love how repositories and entities are separated (i hate models in rails), and love the interactors concept too, callbacks have been very painful for me to work with
i'd love to know what are the some impressive apps built using hanami that are currently being used in production. i've taken a look through http://awesome-hanami.org/#awesome-hanami-hanami-project-list and am wondering if there's more to add to that list
calebbarde
@calebbarde
Hi all - a silly question likely - but coming from Rails and AR, I'm used to validation at both a request level and a model level. Is it idiomatic in hanami to have entity validations (in additions to the automatic schema validations)?
Is there an "idiomatic" hanami project on http://awesome-hanami.org/#awesome-hanami-hanami-project-list (stolen from @matt-from-toronto :) ) that would be a good one to reference overall?
Matt
@matt-from-toronto
@calebbarde you can add custom scheme validations to an entity it seems. https://guides.hanamirb.org/entities/custom-schema/ what validation do you want to add that can't be covered by schema validations, whether automatic or custom?
actually I think I've misunderstood your question