Issue:
npm WARN tar TAR_ENTRY_ERROR ENOSPC: no space left on device
when running npm ci or npm installed or docker-compose up
Solution
The solution is to run docker system prune:
docker system prune
Issue:
npm WARN tar TAR_ENTRY_ERROR ENOSPC: no space left on device
when running npm ci or npm installed or docker-compose up
Solution
The solution is to run docker system prune:
docker system prune
$ git merge TEST_2 Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result.
$git mergetool --tool-help 'git mergetool --tool=' may be set to one of the following: araxis vimdiff vimdiff2 vimdiff3 ...
$ git mergetool --tool=vimdiff
At the root of your project, create a file name DockerFile, without any file extension.
In workdir you put the absolute path to your app.
FROM node:12-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "/app/src/index.js"]
Cd in the directory where your DockerFile is and run:
$sudo docker build -t getting-started .
Don’t forget the “.” at the end of the command!
getting-started is the name of the app you are creating in docker. It will be the name of the image.
$sudo docker run -dp 3000:3000 getting-started
-p 3000:3000 is mapping the internal port 3000 (the 2nd one) to the external port 3000(the first one). So you will be able to access your app on localhost:3000.
First you need to remove the container. For that you will need the container id:
you can get it in two different ways:
$sudo docker ps
or
$sudo docker container ls
that gives you the container process id. You can then stop the container:
$sudo docker stop 123456789
and then remove the container:
$sudo docker rm 123456789
You can also do that in one line by using the force option to close and remove the container in one go:
$sudo docker rm -f 123456789
You’ll need a docker account in hub.docker.com.
Create a repository.
Once the repository is created, you’ll see a Docker command example to push your project in the repo:
$docker push username/getting-started:tagname
https://docs.docker.com/get-started/04_sharing_app/
To have data persitency between restart, you will need to mount a volume in the container. That volume will be available from the host but also from container that has mounted the same volume.
$sudo docker volume create todo-db
$sudo docker run -dp 3000:3000 -v todo-db:/etc/todos getting-started
Now your data will persist between session.
Where the data are actually stored on the disk?
Run:
$sudo docker volume inspect todo-db
It will return:
[
{
“CreatedAt”: “2019-09-26T02:18:36Z”,
“Driver”: “local”,
“Labels”: {},
“Mountpoint”: “/var/lib/docker/volumes/todo-db/_data”,
“Name”: “todo-db”,
“Options”: {},
“Scope”: “local”
}
]
The mountpoint is the actual location of the data on the host.
use bind mount.
Example command:
$docker run -dp 3000:3000 \
-w /app -v ${PWD}:/app \
node:12-alpine \
sh -c "yarn install && yarn run dev"
You can check the logs:
$docker logs -f <container-id>
Why not put it in the same container as your app? It’s because you might not want to ship your development db with your app. You might also want to scale the front-end and the back-end up differently.
$sudo docker network create todo-app
$docker run -d \
--network todo-app --network-alias mysql \
-v todo-mysql-data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_DATABASE=todos \
mysql:5.7
Pro-tip
You’ll notice we’re using a volume named todo-mysql-data here and mounting it at /var/lib/mysql, which is where MySQL stores its data. However, we never ran a docker volume create command. Docker recognizes we want to use a named volume and creates one automatically for us.
docker exec -it <mysql-container-id> mysql -p
Sometimes it’s useful to start with a clean slate and remove all Docker containers and even images. Here are some handy shortcuts.
$docker ps -aq
$docker stop $(docker ps -aq)
$docker rm $(docker ps -aq)
$docker rmi $(docker images -q)
https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
Use the command
docker exec -it <container name> /bin/bash
to get a bash shell in the container.
Error: “ENOSPC: no space left on device, open ‘/app/yarn-error.log'”
Solution: https://docs.docker.com/engine/reference/commandline/system_prune/
docker system prune
will remove networks and containers which are not in use.
docker system prune --all
will remove all network, containers and images.
You can also run the following with the docker you need running:
docker system prune -a --volumes
dir [path] : list the content of a directory
cd [path]: move into that directory
echo sometext > file.txt : create a file named file.txt that contains ‘sometext’
argument[0] is used in javascript function to pass on the value of the WebElement.
exemple:
WebElement webElement = driver.findElement(By.xpath("xpath_element"));
JavascriptExecutor javaScriptExecutor = (JavascriptExecutor)driver;
javaScriptExecutor.executeScript("arguments[0].click()", webElement);
The @ symbol denotes a Java Annotation. What a Java annotation does, is that it adds a special attribute to the variable, method, class, interface, or other language elements.
“In the Java computer programming language, an annotation is a form of syntactic metadata that can be added to Java source code. “
https://en.wikipedia.org/wiki/Java_annotation
sudo apt-get install git
$ git config --global user.name "My Name"
$ cd Desktop/git_exercise/ $ git init
This command will return the current branch as well as it’s status compared to the head.
$ git status
The following command add the file hello.txt to git. This file will mbe included in the next commit.
$ git add hello.txt
or
$ git add -A
equivalent to
$ git add .
The two commands above add all files to git, except the files that are excluded due to git ignore rules.
$ git commit -m "Initial commit."
$ git commit --ammend
To remove the git file and create anew in the repo:
cd /path/to/your/repo
rm -rf .git
git init
In general:
$ git remote add origin https://github.com/user/repo.git
See https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories for more details.
If it’s a commit on the master branch:
$
git push origin master
If it’s a commit on some branch named “some-branch”:
$
git push origin some-branch
In our workflow we shall send code to CR (code review) before it goes to QA.
Create a branch
For that you create a branch, then push the code to your branch and the pull request is done in the master branch dashboard.
$ git branch some-feature
$ git checkout some-feature
You can create the branch and go in the branch in command:
$ git checkout -b some-feature
# Edit some code
$
git commit -a -m "Add first draft of some feature"
$ git push origin some-branch
“After Bitbucket has her feature branch, Mary can create the pull request through her Bitbucket account by navigating to her forked repository and” clicking on P
ull request
s
in the side bar and then “clicking the
Pull request button in the top-right corner.“
Source: https://www.atlassian.com/git/tutorials/making-a-pull-request
More reading: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
https://www.atlassian.com/git/tutorials/saving-changes/gitignore
https://git-scm.com/docs/gitignore
touch ~/.gitignore
git config --global core.excludesFile ~/.gitignore
sudo vim ~/.gitignore
edit file with:
*.css.map
to exclude all files ending with .css.map
for a local approach simply create and edit the .gitignore file in the affected local repository.
If the file has already been staged, remove it by using:
$ git restore --staged <file>.
All those worked:
/source
*/.sass-cache
*/codeStyles
.gitignore
the directory tree was:
|
|-source
|-.sass-cache
|-.idea
|-codeStyles
hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
create a force push:
git push -f origin branchname
https://docs.github.com/en/github/getting-started-with-github/setting-your-username-in-git
cd in the folder were you want to clone the repo:
$ cd directory/you/clone
$ git init
$ git config user.name “Your-Username” #can be different from your github username
$ git config user.email “
your.email@example.com
”
$ ssh-keygen -t rsa -C “
your.email@example.com
”
Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username.ssh/id_rsa
copy the content of the id_rsa.pub in your github settings in your profile.
Set github local authentication to be able to clone and push:
http://kbroman.org/github_tutorial/pages/first_time.html
$git branch
$git branch -r
$git branch -a
$git status
git fetch origin
git reset --hard origin/master
git clone -b <branch> <remote_repo>
git branch -d branch-name
or
git branch -D branch-name
in case the branch to be deleted is not fully merged.