Skip to content

RashidCodes/Devops-Journey-Frontend

Repository files navigation

Introduction to DevOps

This repository is part of a group of repositories called Devops-Journey*. It contains the files of a react application that says "Hello" to anyone.

What I've learned so far...

Docker-compose

Using docker-compose with images can be slightly tricky as compared to simply using a docker run.

Always use a docker-compose down to remove any containers created by compose.


Authentication

Enabling authentication with a mongodb image is a tad complicated however these are the steps I took to successfully enable authentication.

docker-compose up

Go into the mongodb container, 'k8sdb' in this case using the following command

docker exec -it k8sdb /bin/bash

Now create the database of your choice and add a user using the mongo-cli. Assign the user some roles if you will, using the roles array.

>>> mongo
>>> use names
>>> db.createUser({user: 'username', pwd: 'password', roles: []})

Connecting to the DB using mongoose

mongoose.connect('mongodb://mongo:27017/names',{
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useFindAndModify: false,
    useCreateIndex: true,
    user: 'username',
    pass: 'password'
}).then(() => console.log('Successfully connected to names DB))
.catch(err => console.log("Error connecting to names Db"))

It is easier to start a mongodb container without authentication and implement some authentication after building the project with docker compose.


Other topics to remember

  • Environment variables
  • Networks
  • Pushing to a container repository like dockerhub.

Where to, from here...

Practice k8s locally using minikube and then successfully create deployments on kubernetes clusters in the cloud using DigitalOcean or Linode.


Wanna try?

  1. Download the docker-compose.yml file and simply run
docker-compose up

Make sure you're in the directory that contains the docker-compose.yml file.

  1. All codes can be found in the DevOps-Journey-* repositories.

About

A react application that says hello to anyone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published