Skip to content

Add Docker containerization - #14

Open
Pictor13 wants to merge 7 commits into
ojoven:masterfrom
spininelfianco:containerization
Open

Add Docker containerization#14
Pictor13 wants to merge 7 commits into
ojoven:masterfrom
spininelfianco:containerization

Conversation

@Pictor13

@Pictor13 Pictor13 commented Oct 27, 2020

Copy link
Copy Markdown

Ciao @ojoven,

me and @botpartigiano added a Docker environment for the app.
It requires a (decently recent) version of Docker, and can be run with docker-compose up --build.

It will spawn 1 container for the database service and 1 container for each version of the application (bot & view),
so they can run in parallel.
I tried to update the Spanish instructions as best as possible, but maybe it needs a review from a mothertongue 😅

Please, would be great if you could take a look at it, or simply try to run the images and give feedback if any problem arises.
Atm I aim more to get it run everywhere correctly, before thinking to a merge in master.
I dunno if you are confident with docker, but don't hesitate to ask if you have questions 🙃

Note: We tested on Windows and MacOS machines, and it runs. It might be that some platforms still need to be revised;
in particular potential issues with running scripts with different line-endings.

as users might confuse the name of the app with the name of the
database schema.
The schema is always the same, regardless of the name of the database
or the name of the app bot.
to set the default bot name to use, in case a single instance of the
app is being run, or when there is no environment variable set.

And update the README.
for 'json' field that was previously added
to the db schema, without updating the sql
queries.
utilising the new recommended way: pooling connections

Read about it at https://www.npmjs.com/package/mysql#pooling-connections
and specify how to handle the newlines on different platforms,
when checking out shell scripts (for Unix or Windows).

Without this setting checked out in the repository, users that clone
the project over Windows will have problems running scripts into
Docker containers, because files are being copied on it with the
wrong line-ending (Unix use LF; Windows uses CRLF).
Use `docker-compose up` to initialize the 3 containers (1 for the
database service and 2 for the different versions of the application).

Ensure that the `docker-compose.yml` is correctly configured according
to the instructions from the README.

Tested on MacOS 10.14.6 (Pictor13) & Windows 10 (BotPartigiano).
@Pictor13

Copy link
Copy Markdown
Author

There are also some other little thing to fix (I leave some notes here as reminder; not expecting you to be able to understand them all ):

  • like the probe for the mysql connection might return error (when the database service checks itself); but it's a false negative, and should be able to connect anyway. Still looking into it.
  • still checking how to keep the code backward compatible but also allow to not create the config/*.json files, when the environment variables are used.
  • still have to take care of ensuring that grunt works. I guess it should not be part of the Dockerfile.
  • it is not ready to be deployed on some production server yet; security might be improved. If I'll have time I might try to create the conf to deploy on some cloud.
  • when mounting the host app folder to the Node/ExpressJs containers, via docker-compose.yml, there might still be some problems (overrides/empties the node_modules/ folder), that might prevent using (for now) the system for development. However, on MacOS, adding a volume fixed the issue.

For the rest it should be usable, a decent base to have a streamlined development/production system, with single database service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant