Running our service

The only part missing is our main service. We need to rebuild it again. If you change the source code to use RethinkDB again, you have to change the package.json  file in order to have different dependencies. We need to rebuild this using our Dockerfile. To avoid introducing another theme, which is Docker Volumes, let's change our RethinkDB connection to not depend on the settings file:

rethinkdb.connect({ host: "database", db: "imagini" }, (err, db) => {

This way, we can avoid mounting a settings file altogether. Now, let's just increment the version and build it on both tabs:

docker build -t imagini:0.0.6 .

Now, the only thing missing is creating our service:

docker service create --name imagini --network imagini --publish 80:3000 imagini:0.0.6

In just a few seconds, we have our service running:

We can even scale it right away and have three instances:

We can see that it's exposed on port 80. As we did previously, we can see that the service is up and running. I'll just upload the example image again as this is a clean service and it has no images yet:

You can see it on the RethinkDB administration interface. And even if we use the other swarm address, we see that the image is now available to download:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset