Should a developer be able to create a docker artifact from a lerna monorepo in their development environment?

I’ve recently started using lerna to manage a monorepo, and in development it works fine.

Lerna creates symlinks between my various packages, and so tools like ‘tsc –watch’ or nodemon work fine for detecting changes in the other packages.

But I’ve run into a problem with creating docker images in this environment.

Let’s say we have a project with this structure:

root   packages      common → artifact is a private npm package, this depends on utilities, something-specific      utilities → artifact is a public npm package      something-specific -> artifact is a public npm package      frontend → artifact is a docker image, depends on common      backend → artifact is a docker image, depends on common and utilities 

In this scenario, in development, everything is fine. I’m running some kind of live reload server and the symlinks work such that the dependencies are working.

Now let’s say I want to create a docker image from backend.

I’ll walk through some scenarios:

  1. I ADD package.json in my Dockerfile, and then run npm install.

    Doesn’t work, as the common and utilities packages are not published.

  2. I run my build command in backend, ADD /build and /node_modules in the docker file.

    Doesn’t work, as my built backend has require('common') and require('utilities') commands, these are in node_modules (symlinked), but Docker will just ignore these symlinked folders.

    Workaround: using cp --dereference to ‘unsymlink’ the node modules works. See this AskUbuntu question.

  3. Step 1, but before I build my docker image, I publish the npm packages.

    This works ok, but for someone who is checking out the code base, and making a modification to common or utilities, it’s not going to work, as they don’t have privledges to publish the npm package.

  4. I configure the build command of backend to not treat common or utilities as an external, and common to not treat something-specific as an external.

    I think first build something-specific, and then common, and then utilities, and then backend.

    This way, when the build is occuring, and using this technique with webpack, the bundle will include all of the code from something-specfic, common and utilities.

    But this is cumbersome to manage.

It seems like quite a simple problem I’m trying to solve here. The code that is currently working on my machine, I want to pull out and put into a docker container.

Remember the key thing we want to achieve here, is for someone to be able to check out the code base, modify any of the packages, and then build a docker image, all from their development environment.

Is there an obvious lerna technique that I’m missing here, or otherwise a devops frame of reference I can use to think about solving this problem?

Development and Production on the same RDS instance, but under different databases?

I was told to create a single RDS instance (amazon web services RDS) onto which I should create two users, development and production, and two databases, development and production. The idea is that the development user only has access to the development database and production user only has access to the production, which would make it secure.

In other projects we’ve had separate RDS instances for development and production, but they want to save costs. I’m not too sure about it.

Is it a bad idea?

Is Behavior Driven Development Worth It and Plausible

Test-driven and behavior-driven development seem to appeal to me. Perhaps it is because I like to have things organized and neatly done. I also like to be confident in the conclusions I make, which spills over to the products I put out as well. Do not confuse this with OCD.

However, I am wondering if it is actually plausible to use BDD or TDD for some rapid development. Suppose I would like to build a site. I am aware of some features it must have in the beginning. However, I am also aware that it will grow. New pages and functionality will be added. On the one hand, it seems prudent to write some functional and unit tests. This way, I will feel more confident in the product since I am currently the only one working on it. It will get to a point where it is impossible to notice all consequences of your changes without automated tests.

On the other hand, it appears to be an overkill to do this for a relatively basic app. I know plenty of people who would just take a few weeks and use their nights and weekends to build it quickly without tests. What happens after that in this case I do not know because I have not been there. My experience with TDD has been in places where the software is so complex that one would not even think of making commit without testing or writing a unit-test first.

As a more general question, is BDD a utopia or does it actually make one (or organization) more productive?

What has your experience been? What is the line one should stride and how does he find it?

Much appreciated.

Is Block Finalization a valid development to remove the threat of 51% attacks?

A recent comment from a Reddit user in response to BTC.top acquiring 54 of the Bitcoin Cash has hate noted that a Block Finalization development removes the threat of a 51% attack.

I have never heard of block finalization before but my understanding is that it results in nodes reject the altering of blocks once they have reached a certain amount of confirmation in the blockchain. At the moment, I believe it stands at ten confirmations in the Bitcoin Cash blockchain.

Is this a valid development? Are there limitations to it?

PWA Store Deployment on server – Development

I would like to know how to deploy PWA store (With magento pwa-studio) on staging or any other server without passing the PORT number ?

I am working on currently PWA demo instance (Latest Magento version 2.3.1) – as PWA apps running with port number only – URl like – local.pwa.local:2823 (So URL with Port number)

What i want is to run PWA application on my server without port number,directly with the domain name Like – https://mypwa.com

As of now what i have tried as an prerequisite is as below :

  • SSL is already enabled on server
  • PWA is running with PORT Number on server
  • Able to set my custom URL with Port number on server
  • Using nginx reverse proxy i have redirected port number with 443 and store is loading with only domain as well – but issue here is assets are not loading and it gives error.
  • It giving CORS policy error as well.

Can anybody have achieve the same ? is there any standard practice that we need to follow to deploy the pwa-studio ?

Looking forward to here your thoughts/suggestions on the same.

Platform to learn web development for beginners

Hello,

My name is Gancho Radkov I am a self taught developer.

In 2016 It took me ~5 months to get a job as developer from complete beginner. Since then I've climbed to lead developer in german web agency.

I am currently leading a team of 5 developers – 1 self taught, 4 with Masters in CS.

I've decided that I would like to help others who wish to become web developers/learn to code but can not go college or university for whatever reason by creating a platform and with an educational…

Platform to learn web development for beginners