Coder Social home page Coder Social logo

9ts's Introduction

Project setup for development

Create the environments

$ cp .env.example .env

Update with correct values

ENV_VAR=value

Start the servers (tested on linux)

WARNING: You might have to modify the docker-compose command in the .aliases file to match your system!

$ source .aliases
$ dc up -d
[+] Running 3/0
 ✔ Container 9ts_db            Running     0.0s
 ✔ Container 9ts_backend       Running     0.0s
 ✔ Container 9ts_frontend      Running     0.0s

View logs (assuming that you sourced .aliases)

$ dclogs <service name>

example:

$ dclogs backend
9ts_backend  |
9ts_backend  | > [email protected] dev
9ts_backend  | > ./node_modules/.bin/nodemon server.js
9ts_backend  |
9ts_backend  | [nodemon] 2.0.20
9ts_backend  | [nodemon] to restart at any time, enter `rs`
9ts_backend  | [nodemon] watching path(s): *.*
9ts_backend  | [nodemon] watching extensions: js,mjs,json
9ts_backend  | [nodemon] starting `node server.js`
9ts_backend  | Server Started
9ts_backend  | Connected to MongoDB as root@db:27017
9ts_backend  | sending to next page

Use mongo on the shell (assuming that you sourced .aliases)

$ dc exec db bash
root@bf32c802d775:/# mongosh
Current Mongosh Log ID: 641d205916f7a56a64b8b14f
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.8.0
Using MongoDB:          5.0.15
Using Mongosh:          1.8.0

For mongosh info see: https://docs.mongodb.com/mongodb-shell/

------
   The server generated these startup warnings when booting
   2023-03-24T03:52:13.472+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
   2023-03-24T03:52:14.276+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2023-03-24T03:52:14.276+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
------

------
   Enable MongoDB's free cloud-based monitoring service, which will then receive and display
   metrics about your deployment (disk utilization, CPU, operation statistics, etc).

   The monitoring data will be available on a MongoDB website with a unique URL accessible to you
   and anyone you share the URL with. MongoDB may use this information to make product
   improvements and to suggest MongoDB products and deployment options to you.

   To enable free monitoring, run the following command: db.enableFreeMonitoring()
   To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
------

test> use musicapp
switched to db musicapp
musicapp> show collections
users
musicapp> db.users.find()
[
  {
    _id: ObjectId("641d1e3c6cd736ea21137868"),
    name: 'John Smith',
    email: '[email protected]',
    password: '$2b$10$MaG4xoEopgwPz1MfDpUdReSsIQ6D98XLOtDxfS2f5PvGYxdgsngJe',
    __v: 0
  },
  {
    _id: ObjectId("641d1ea4ad48b04b31b9d80b"),
    name: 'Victor Frankenstein',
    email: '[email protected]',
    password: '$2b$10$KkUVJo8TkMAfyJsMV1N9WeKLeHFXoNV5QROLmT2FWsv9eL.i/LhXW',
    __v: 0
  }
]

To exit the mongo shell use Ctl-C or Ctl-D and then type exit to exit the container

musicApp>
root@bf32c802d775:/# exit
exit

Closing the environment (assuming that you sourced .aliases)

$ dc down
[+] Running 5/5
 ✔ Container 9ts_frontend          Removed   0.9s 
 ✔ Container 9ts_backend           Removed   1.1s 
 ✔ Container 9ts_db                Removed   0.4s 
 ✔ Network 9ts_backend-mongo       Removed   0.2s 
 ✔ Network 9ts_backend-frontend    Removed   0.3s 

Getting Help

$ dc
Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters
                                   ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file stringArray       Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --parallel int               Control max parallelism, -1 for unlimited
                                   (default -1)
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the, first specified,
                                   Compose file)
  -p, --project-name string        Project name

Commands:
  build       Build or rebuild services
  config      Parse, resolve and render compose file in canonical format
  cp          Copy files/folders between a service container and the local filesystem
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  pause       Pause services
  port        Print the public port for a port binding.
  ps          List containers
  pull        Pull service images
  push        Push service images
  restart     Restart service containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     Unpause services
  up          Create and start containers
  version     Show the Docker Compose version information

Run 'docker compose COMMAND --help' for more information on a command.

9ts's People

Contributors

djuchdev avatar dovrine 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.