someLocalDev
Playing around with Ubuntu Multipass on MacOS
install multipass per instruction
multipass launch --cpus 4 --disk 40G --mem 8G --name portnr docker
creates a Ubuntu VM w/ Portainer installed.
get IP address of VM - for accessing portainer UI
multipass list
multipass shell portnr (to get shell into ubuntu - use this to create various dirs ...for containers persistence)
visit 192.168.x.x:9000 for Portainer UI.
create admin user and passwd
In portainer- can launch containers from templates (like mongo) or from docker.io (hub.docker.com) registry.
---
Tried NextCloud:
container is nextcloud
attach 2 volumes
--
interactive alpine.
add a container w/ tag 'alpine' but change the config in the command tab of portainer as 'interactive & tty' (this send docker cli -i -t params)
Click on 'Deploy the container'
Once the container is up and running - go to the console.
get access to alpine shell.
need to figure out- if i make changes and install tools like dropbear - how to keep it persistent. for the moment, the shell allows me to install stuff and play around with the 'internal network' (172.17.x.x)
----
Install Mongo
using the template, however couple of change:
volume (bind) ... this keeps storage persistent.
/data/db --> /home/ubuntu/mongo/db
/data/dbconfig --> /home/ubuntu/mongo/dbconfig
(in our setup, did not do this binding... docker created a vol in var/lib/docker/volumes/<randomshit>/_data ... not sure if this will survive container kill :P )
network: container port 27017 exposed to any host (ubuntu) port.
This allows connection within the 'docker network' as well as from Mac (using 192.168. range)... though, practically need only the docker network.
Attach a console to get into the shell and follow this advise:
https://betterprogramming.pub/add-authentication-to-mongodb-in-portainer-docker-30a60ab7858a
to create an account
The cli is mongosh
then
mongosh mongodb://localhost:27017 --username bloke --password <*******> --authenticationDatabase admin
>show dbs
more mongo commands- like creating user etc:
https://www.mongodb.com/basics/create-database
imp mongo creates a DB on first entry.
so follow instructions from the above link to create appsmith db:
use appsmith
db.user.insert({********})
WriteResult({ "nInserted" : 1 })
show dbs
this shows appsmith DB being created.
now we need the user bloke to be assigned to DB appsmith
use appsmith
db.getUser("bloke")
will show that bloke has no rights/roles with appsmith
use admin
db.getUser("bloke")
shows bloke has roles as root in admin.
simplest - we added another user (same bloke) for appsmith db
user appsmith
> db.createUser (
... {
... user: "bloke",
... pwd: "joeHere1",
... roles: [{ role: "dbOwner", db: "appsmith"}]
... }
... )
> db.getUser("bloke")
--
Settting up appsmith: https://docs.appsmith.com/getting-started/setup/installation-guides/docker
the image is appsmith/appsmith-ce (community edition)
Map volume (deciphering their docker compose file):
/appsmith-stacks --> /home/ubuntu/appsmith
Expose port 80 to the world.
Deploy the container.
log in and go thru 'registration'
check DB connection to 'other' container:
mongo mongodb://bloke:joeHere1@172.17.0.3:27017/appsmith
this will work- if the user has been properly created for DB Appsmith AND the db appsmith has been created.