Git Product home page Git Product logo

idtcday1's Introduction

idtcDay1

  1. Clone the repository from here. cd idtcDay1
  2. Go into app directory cd app
  3. Install required dependencies npm install
  4. Create docker network docker network create mongo-network
  5. Start mongodb container docker run -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password --name mongodb --net mongo-network mongo
  6. Start mongo-express docker run -d -p 8081:8081 -e ME_CONFIG_MONGODB_ADMINUSERNAME=admin -e ME_CONFIG_MONGODB_ADMINPASSWORD=password --net mongo-network --name mongo-express -e ME_CONFIG_MONGODB_SERVER=mongodb mongo-express
  7. Open mongo-express from browser http://localhost:8081
  8. Create user-account database and users collection in mongo-express
  9. Make changes in server.js • Comment line 29 • Remove comment from line 26 • Replace mongoUrlDocker with mongoUrlLocal on line 41 and 71
  10. Start your nodejs application node server.js
  11. Access it from the browser http://localhost:3000 Till this you have successfully deployed your app locally with mongoDB container. Now you need to build your app so that you can push it to dockerhub.
  12. Go to docker-hub create an account.
  13. Create a repository my-app on docker hub
  14. Go to idtcDay1 directory on your PC cd ..
  15. Undo the changes done in server.js in step 9.
  16. Delete node_modules folder from app directory.
  17. Edit build my-app image docker build -t /my-app:1.0 .
  18. Edit the docker-compose.yml file 25: image: /my-app:1.0
  19. Start mongodb, mongo-express an my-app docker-compose -f docker-compose.yaml up
  20. You can access the mongo-express under localhost:8080 from your browser
  21. In mongo-express UI • Create a new database my-db • Create a new collection users in the database my-db
  22. Access the node.js application from browser http://localhost:3000
  23. Push your image to docker hub docker push /my-app:1.0

idtcday1's People

Contributors

kroy96 avatar swayam933 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.