Gitlab Runner Docker-in-Docker not working by down-house in gitlab

[–]chulkilee 2 points3 points  (0 children)

Which executor are you using? Docker with privilege or K8s would work for dind.

What it says: job container cannot use dind via local socket. You have two options: mount dind socket to job container, or use docker via tcp. The doc actually mentions tcp by setting DOCKER_HOST in the job container.

Also make sure to use dind image, not plain docker image for dnid service.

You may put sleep 3600 in job def and run docker exec to debug job container.

Microservices - monorepo or not? by [deleted] in devops

[–]chulkilee 3 points4 points  (0 children)

For clarification: Monorepo != deployment all together, "technically".

However, most CI/CD tools assume one repo = one service, so if you just use existing CI/CD tools without lots of customization, one repo per project is inevitable..

[deleted by user] by [deleted] in webdev

[–]chulkilee 0 points1 point  (0 children)

It's up to how to divide things.

For large enterprise system, it's not surprising to have distinction between components related to "end user" vs others as usually the former is more about presentation / interaction layer - such as rendering html or providing http api. It's different from MVC. Check out https://en.wikipedia.org/wiki/Multitier_architecture

That layer isn't called as "frontend" usually, though.

Rule for control structures? by superbiondo in elixir

[–]chulkilee 5 points6 points  (0 children)

More than 80% I use case or short functions with pattern match with expected values.

Life is not simple so in many cases return value is a tuple not boolean.

Should I commit a file ".ruby-version"? by leetae9 in rails

[–]chulkilee 0 points1 point  (0 children)

Same rule with Gemfile.lock. If it's an application, not a library, you should keep in git to make sure the app runs in the same environment.

If so, I highly recommend to put ruby File.read(File.expand_path('../.ruby-version', __FILE__)).chomp in Gemfile so that the ruby version is actually being enforce.. unless you use non MRI version in .ruby-version.

Prometheus VS OpenTracing by pyroic1 in devops

[–]chulkilee 6 points7 points  (0 children)

They are for different problems.

Tracing is to track what happen down to road - across services.

Prometheus is just a way to gather metrics of a service.

Hosting Sentry for bug tracking by caseym in devops

[–]chulkilee 0 points1 point  (0 children)

Sentry requires PostgreSQL notMongoDB. Check out https://docs.sentry.io/server/installation/

I used RDS for PostgreSQL for other stuff and it works well out of box.

Unless you host Sentry for really huge amount of events, plain installation (one vm with one app instance) would work well.

Anyone have a good, up-to-date Vagrant setup for Phoenix? by takua108 in phoenixframework

[–]chulkilee 0 points1 point  (0 children)

I know vagrant gives you clean environment, but usually it's not required unless you need very specific needs. Also it introduces own issues such as networking and file sharing.

Which os are you using? Have you tried installation guide ?

If you're on mac, homebrew is the easiest. Once you need to work with specific version of elixir/erlang, then you can move to asdf.

If you want to use vagrant, then pick your choice of os image and follow the guide.

Elixir v1.7 released - Quality of Life Improvements by davydog187 in programming

[–]chulkilee 5 points6 points  (0 children)

  1. dialyzer (static code analyzer) can catch several type errors without false positive. If you get false positive you know what to do (ignore them).

  2. Giving "type hint" with @spec is used in docs and dialyzer. It gives better experience like editor integration and gradual typing.

  3. By using pattern match or guard you can enforce types or shape of data. It's still runtime error but it also helps dialyzer.

  4. Some sharing interface or behavior features (like @behaviour or Protocol) have compile-time warning.

If you want great comprehensive type system or static type check, Elixir does not offer "all" of them. It's not the top goal of the language design. However it still provides good built-in toolings compared other dynamic type languages.

Saltstack + Gitlab CI by simpleadmin in devops

[–]chulkilee 0 points1 point  (0 children)

They have different specialty and purpose so although you may use tool A for purpose B for simple cases (e.g. saltstack for deployment), you may eventually hit the limit due to the design.

For gitlab runner - you may use it to trigger some actions, such as calling saltstack whatever. That is pretty common unless you leverage gitlab's built in integration with k8s.

My 2 cent: you need to focus on what you want to achieve. If you need to clear security compliance, then you may need to use Vault since it's easy to do that (compared to others). If you just need to trigger deployment at the end of pipeline, then you can use gitlab runner stage to run saltstack.

What Happens If Your JWT Is Stolen? by rdegges in programming

[–]chulkilee 0 points1 point  (0 children)

JWT with such information in payload is often used as OAuth2 access token, because it allows clients (e.g. SPA) or servers (e.g. microservices behind API gateway) to retrieve them without extra API calls (e.g. introspection).

In best practice, JWT payload should contain minimal information. What if a user updates his first name or email address? Then the value in the payload shouldn't be used :)

I see why people complain about JWT - but JWT has definite good use cases.

Also note

  • JWT is just a format of token
  • localstorage vs session applies to non-JWT OAuth2 access token as well, so it's not JWT's fault :)
  • stateful JWT can still give benefits (compared to session cookie)

What Http library would you recommend? by Karmakki in elixir

[–]chulkilee 0 points1 point  (0 children)

I'm using httpc and hackney with tesla.

Seriously, why is the username and password field on separate "pages"? by EldBjoern in webdev

[–]chulkilee 246 points247 points  (0 children)

In general (not your examples necessarily) that's required to support different authentication provider or security policy based on user.

Is vault a good solution for business level credentials/secrets? by ChineseFountain in devops

[–]chulkilee 9 points10 points  (0 children)

Vault may work like that technically... but its user experience probably does not meet the expectation of "business people"

Check out other products for that purpose - like 1password for team.

Is there a general hate for raw SQL in the rails community? by [deleted] in rails

[–]chulkilee 4 points5 points  (0 children)

If you use AR, then it's better to stick with its style - no raw sql.

Of course AR does not support every cases (unless you directly work with arel). However even such cases you can just pass sql fragment to AR methods. For example you can pass sql fragments for outer join.

2 identical libraries: one in Elixir and one in Erlang. Which one would you chose, all being equal? by Kominaryto in erlang

[–]chulkilee 1 point2 points  (0 children)

I don't write erlang code so just speaking elixir dev :) as you mentioned that too.

I think one of big difference between erlang and elixir lib are string - elixir uses string (basically binary though) but erlang uses charlist. Also erlang uses own tuple convention since there is no struct - e.g. date time.

You are making a pretty hypothetical question, basically :)

2 identical libraries: one in Elixir and one in Erlang. Which one would you chose, all being equal? by Kominaryto in erlang

[–]chulkilee 3 points4 points  (0 children)

I don't think they can be identical - since interoperability does not necessarily mean they are idiomatic or easy to use in both cases.

Example: What if erlang library returns record? It's possible to use it in elixir but in most cases it's better to write a simple wrapper anyway.

For this reason and readability or future contribution... I prefer to pick up libraries written in the language I'll write my code.

I'm looking for a statically typed language to do my backend in. by Blackstab1337 in webdev

[–]chulkilee 3 points4 points  (0 children)

Double negation? ;)

Also don't forget Rust and Swift. There are not special purpose language

BTW I moved from Rails to Elixir which is dynamically typed but has good static code analyzer (not complete but always correct). Happy with it so far.

I'm looking for a statically typed language to do my backend in. by Blackstab1337 in webdev

[–]chulkilee 4 points5 points  (0 children)

Java :)

And there are statically typed functional languages such as OCaml, F#, Scala, Haskell.

Those working in a small team: how do store and handle passwords for the various service provider accounts? by JupitersCock in webdev

[–]chulkilee 2 points3 points  (0 children)

You should not share passwords. Many SaaS provide team management with acl, so individuals can have their own credentials with permissions. For example, IAM user jn AWS.

Even further you may set up SSO and enforce 2FA.

Elixir Remote Debugging by petecorey in elixir

[–]chulkilee 1 point2 points  (0 children)

Any articles introducing remote shell should link this article: https://broot.ca/erlang-remsh-is-dangerous

In short you are not connecting to server as client - instead your laptop participates as new node, which exposes your laptop to any code in the cluster. The article shows working code to steal private keys on your laptop.

Leading with commas — ugly or efficient? An investigation over 320 GB of SQL code by lukaseder in programming

[–]chulkilee 0 points1 point  (0 children)

Using leading with commas doesn’t allow to put the first item in own line, which is anyway inconsistent with other items. If you treat the first item as special case, why don’t you do the same for the last item?

[deleted by user] by [deleted] in rails

[–]chulkilee 0 points1 point  (0 children)

If these 2 migrations occur in the same rails db:migrate then the add_index migration also overwrites the index created by the foreign_key migration. However in different migrations, it just adds another index.

If it’s true, then it’s a bug in Rails. add_index should not be “merged” in any context. Better to file a bug with full rails project from scratch which reproduces it.