mysql client on github codespaces - github-codespaces

I'm trying to install a mysql client on a devcontainer and was wondering if there's an easy way to get this up and running instead of adding a block of apt-get statements in the devcontainer docker file.

Related

Installing Laravel in Docker Container

Environment: Windows 11 + Docker Desktop 4.12.0
I've been digging this the entire morning. There doesn't seem to be a way of installing Laravel in a Docker image. You must curl it in your WSL2 distro. Trying the command curl -s https://laravel.build/example-app | bash in a Docker container command-line immediately returns the dreaded Docker is not running error message
Some suggest that I need to turn on my "WSL2 integration" checkbox in Docker Desktop settings, but that didn't help.
So what if I download the official Ubuntu image from Docker Hub, run it as a container. Can I download (curl) Laravel in that container?
And while we are here, how does the Bitnami Laravel image differ from the standard procedure given in Laravel documentation? I like it because I can download it as a normal Docker image and create as many containers as I want, but I'm unsure how this connects or contrasts with the official Laravel method.
If it helps anyone, the curl -s https://laravel.build/example-app | bash command downloads several Docker images including MariaDB, Redis, mailhog etc. and therefore needs Docker to be running on the host machine (which is not available inside a container, that's why you can't run the curl command there). Once downloaded, it creates a new container containing (no puns intended) one container for each of these images. You can also customize the list of images/containers that your Laravel application needs by passing the list of services in the curl command like this: curl -s https://laravel.build/example-app?with=mysql,redis. Thanks #apokryfos for the helpful comment. Once these containers are running, you can use VSCode (together with GIT) to connect to them and do your development work.
Of course, you can still use the old-school method of Laravel development. Just install XAMPP or one of its cousins on your machine and then use composer create-project command from the terminal to create it on your local file system. Then host your database and website on locally running instances of Apache and MariaDB.
I have yet to check out Bitnami Laravel image and how it works.

apt-get command not found in coreOS (cos)

I would like to install tools in my cluster VM to debug, like dnsutils or mysql to test connections.
My cluster VM use container optimized OS (cos).
Whenever I try
apt-get update
I got an error
-bash: apt-get: command not found
How could I achieve this ?
As explained here, execute
/usr/bin/toolbox
It will download docker images and login inside once completed, as root user.
You will be able to execute commands like apt-get update / install and debug

Could not execute Node.js Cloud9

I am trying to use Cloud9 IDE on a server. I added the SSH key and once I try to SSH into the server the error message
Could not execute node.js on root#xxx.xxx.xxx.xxx
appears.
I have nodejs installed on the server, v0.10.25
You need to install the package "nodejs-legacy".
apt-get install nodejs-legacy
The SSH dialog allows you to set the path to the Node.js binary. That should solve your issue.
I found it is necessary to scroll down and click on the advanced tab. Then I entered /usr/bin/nodejs from my "which nodejs" output in my SSH session. This worked for me even though the documentation states AWS tries to do this by default. That left me in the AWS file work space on the server I ssh'ed into as desired.
nodejs was not installed on my EC2 instance, so I installed using the instructions from the following link, and it work perfectly. Tutorial: Setting Up Node.js on an Amazon EC2 Instance
sudo apt-get install nodejs worked for me

Redis installation error ./redis-trib.rb not found

I am trying to install redis cluster in ubuntu server using ssh. I don't have sudo permissions to install something in the server.
When I was trying to use the command to create the cluster.
./redis-trib.rb create --replicas 1 127.0.0.1:30000
127.0.0.1:32000 127.0.0.1:32001 127.0.0.1:32002
I got the error as follows
./redis-trib.rb command not found.
I know that I need to install ruby gems to solve the issue. since I dont have sudo permisiion, can you suggest an alternate way to configure it.

Database support on Cloud 9

Does Cloud 9 support any databases? Can my app talk to a database? MongoDB, Sqlite... anything?
If so, how do i set it up? I am willing to work with any database. I just want to persist some of my info into a database.
These days the workspaces are just Ubuntu VMs, so just follow the instructions on installing your favourite database on Ubuntu.
E.g.
Postgres: sudo apt-get install postgresql postgresql-contrib
MongoDB:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
Sqlite: sudo apt-get install sqlite3 libsqlite3-dev
Cloud9 now allows you to run MongoDB from within Cloud9. Here are instructions on how to set it up in your workspace:
https://docs.c9.io/setting_up_mongodb.html
Cloud 9 comes easily configurable with either the following databases:-
MySQL - https://docs.c9.io/setting_up_mysql.html
MongoDB -
https://docs.c9.io/setting_up_mongodb.html
SQLite -
https://docs.c9.io/setting_up_sqlite3.html
I'm using Cloud 9, and there's a local mongod on the slice. You need to use a terminal to run it.
MongoDB is installed by default when you create a new workspace on Cloud9. What usually works for me is to open a second terminal window and start mongodb.
Type ./mongod to start mongodb.
Leave that terminal running and now you can interact with mongo via the primary terminal.
To get started you would type mongo $IP. Now you're ready to go. MongoDB shell version: ..* will echo to the screen and tell you that it's connecting to: 127...*/test
When you do this you will notice that the terminal session where you started mongo will say something like connection accepted from 127...* #1 (1 connection now open)
See the mongodb site for a list of commands - I assume you know what you're doing.
The terminal is Cloud9 is a fully functioning terminal so you can even seed your db with data from an external js file. There is lots of documentation online that explains how to do this but basically you can create js file and add a db.collectionname.save({"name":"value"}); entry for every document you want to add.
In the terminal you can load up this file by doing something like this:
mongo $IP/test data.js. I assume you put the file in the workspace root.

Resources