https://github.com/fadilxcoder/mongodb
MongoDB with PHP using Docker containers & cloud
https://github.com/fadilxcoder/mongodb
docker mongodb php poc
Last synced: 6 months ago
JSON representation
MongoDB with PHP using Docker containers & cloud
- Host: GitHub
- URL: https://github.com/fadilxcoder/mongodb
- Owner: fadilxcoder
- Created: 2020-10-02T17:04:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-04T19:05:28.000Z (over 3 years ago)
- Last Synced: 2025-01-04T19:23:45.268Z (over 1 year ago)
- Topics: docker, mongodb, php, poc
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker, MongoDB (GUI) & PHP on AWS C9
- All configs regarding building the docker container is in `docker` folder
- 2 files needed for mongodb : `Docker` & `mongod.conf` - **Important settings in mongod.conf (bindIp, dbPath, path)**
- 2 folders needed for mongodb : `db` & `logs`
## Third party
- mongo-gui (Viewing MongoDB) - https://www.npmjs.com/package/mongo-gui
## SetUp
- Delete all images : `docker rmi -f $(docker images -a -q)` - *optional*
- Delete containers : `docker rm fx_mongo_database fx_nginx fx_php_fpm` **names found in `docker-compose.yml`, use `docker ps -a` to check if name of containers exist** - *optional*
- Change folders rights : `chmod 777 docker/mongodb/db/ docker/mongodb/logs/`
- Build application : `docker-compose up --build`
## App settings
- In php file, connecting to mongoDB : `(new MongoDB\Client('mongodb://myuser:docker@172.19.0.1:27017'))->mydb;`, *where most settings is in docker-compose.yml file & IP is from **fx_nginx***
## Go live
- Install NGROK
- use `docker ps -a` to see PORTS
## Start application
- Start docker by `docker-compose up`
- Start NGROK & lanch App by `ngrok http 8881` *where 8881 is port*
## Start Mongo GUI
- After containers are UP, Start NGROK (Mongo GUI) by `ngrok http 4321` *where 4321 is port*
## Resources
- https://docs.mongodb.com/manual/crud/ (MongoDB CRUD Operations)
## MongoDB Atlas / Windows
- Windows DLL : https://pecl.php.net/package/mongodb
- Download, rename file `.pem` to `.cer` and install : https://letsencrypt.org/certs/lets-encrypt-r3.pem
- https://www.mongodb.com/docs/manual/reference/connection-string/ (Connection query parameters options)
- https://cloud.mongodb.com/ - DB
- **DB settings** : `(new MongoDB\Client('mongodb+srv://xXxXxXxX:XxXxXxXxXxXxXXx@CLUSTER.xXxXxX.mongodb.net'))->my_database_name;`