Jenkins, From Zero To Hero Become a DevOps Jenkins Master
Source
jenkins/centos7/Dockerfile
Error
Step 2/7 : RUN yum -y install openssh-server ---> Running in 7e18f84a2754 CentOS Linux 8 - AppStream 391 B/s | 38 B 00:00 Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist ERROR: Service 'remote_host' failed to build: The command '/bin/sh -c yum -y install openssh-server' returned a non-zero code: 1
Solution
FROM centos:centos7
Remark
Related to new CentOS 8 Stream
Topic
Jenkins, From Zero To Hero Become a DevOps Jenkins Master
Make the script permanent outside of docker container by using volumes but remember to make it executable.
Topic
Jenkins, From Zero To Hero Become a DevOps Jenkins Master
Source
jenkins > docker-compose build
Error
/bin/sh: 1: python: not found ERROR: Service 'jenkins' failed to build: The command '/bin/sh -c curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py --user && python -m pip install --user ansible' returned a non-zero code: 127
Solution
# Dockerfile USER root RUN apt-get update && apt-get install -y python3 python3-pip RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ python3 get-pip.py --user && \ python3 -m pip install ansible
Remark
Tutorial videos based on Python 2 and outdated installing Ansible with pip commands.
Topic
GitLab, CI/CD Getting Started
Source
GitLab > (your project) > CI/CD > Pipelines
Error
Preparing environment Running on devops… ERROR: Job failed: prepare environment: exit status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Solution
Comment out last 3 lines /home/gitlab-runner/.bash_logout # ~/.bash_logout: executed by bash(1) when login shell exits. # when leaving the console clear the screen to increase privacy #if [ "$SHLVL" = 1 ]; then #[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q #fi
[AWS EC2] Instances (running) x API Error | Dedicated Hosts x API Error Instances x API Error | Key pairs x API Error $ terraform apply Error: Error launching source instance: UnauthorizedOperation: You are not authorized to perform this operation. Encoded authorization failure message: bgJ7KtftIXVield6dlQyqxtJ
Solution
Delete and re-create the (non-root) user and re-assign required permissions policies.
Remark
stackoverflow.com mentioned keys got revoked because AWS detected access key/secret key was exposed/ compromised.
Topic
AWS Application Load Balancer – 503 Service Temporarily Unavailable
Source
Terraform (main.tf) > AWS (EC2/ALB) > Browser
Error
http://terraform-asg-example-15464xxxxx.us-east-2.elb.amazonaws.com/ 503 Service Temporarily Unavailable
Solution
# Find aws_autoscaling_group resource and add this line in Terraform main.tf resource "aws_autoscaling_group" "example" { target_group_arns = [aws_lb_target_group.asg.arn] ... } [Manual fix] Go AWS EC2 > click Target Groups > click affected group > Register targets > Check Instance ID (e.g. EC2) > Include as pending below > Register pending targets
Go to browser and retry http://terraform-asg-example-15464xxxxx.us-east-2.elb.amazonaws.com/
Remark
The target group is created but contains no EC2 instances hence HTTP Error 503 is returned.
[List all volumes] docker volume ls -q (prometheus is the container name and prometheus-data is the volume) prometheus_prometheus-data [Delete prometheus volume only] $ docker volume rm prometheus_prometheus-data
Remark
To delete data/chunks_head/000476 is one of the solutions. However, Prometheus is using Docker, trying $ docker exec -it prometheus bash will result in Error: No such container: prometheus because it fails to start up. This will result in historical data loss but configurations remain intact
Topic
http port [8000] – port is already bound. Splunk needs to use this port.
Source
CentOS 8 | Splunk v9
Error
$ sudo /opt/splunk/bin/./splunk start Checking http port [8000]: not available ERROR: http port [8000] - port is already bound. Splunk needs to use this port.
Solution
$ sudo dnf install nmap $ sudo nmap localhost Not shown: 992 closed ports PORT STATE SERVICE 22/tcp open ssh 8000/tcp open http-alt
Remark
netstat -an | grep 8000; fuser -k 8000/tcp; lsof -i TCP:8000; grep -rnw '/etc/httpd/conf.d/' -e '8000'. All these commands will not find the associated PID using port 8000 except when using nmap shows it is alternate http
Topic
Remove ‘already committed’ .vscode directory from Git repository
Source
GitLab
Error
Many existing projects have committed and uploaded the sftp.json file which stores servers login details.
Solution
Create .gitignore to not push hidden folders and files by adding .* !/.gitignore Above step is preventive but to remove .vscode folder already in Git repo, go Git Bash git rm -r --cached myFolder Finally, commit and push all changes.
Remark
SFTP is a useful plugin for Visual Studio Code but the sftp.json file will get push to Git together with the rest of the project files if no .gitignore is deploy.
Topic
Visual Studio Code failed to push codes to Bitbucket repository
Source
Bitbucket
Error
Despite entering correct username and password, Sync Changes in VS Code fails with errors: bitbucket fatal: Invalid credentials Login failed due to incorrect login credentials or method
Solution
1. Log in Bitbucket account 2. Personal settings > Create app password 3. Enter label name (e.g., syncrepo) 4. Tick checkboxes for Repositories: [ ] Read [ ] Write 5. Copy the ‘token’ and store it somewhere because cannot retrieve it again. 6. Commit and Sync Changes from VS Code > Username: (same) Password: (token)
Remark
If VS Code hang during sync changes, close and restart VS Code and try again. A pop-up may appear asking to grant permissions due to two-factor authorization.
Topic
Visual Studio Code – Trim Trailing Whitespace Breaks Markdown
Source
Visual Studio Code
Error
For a Markdown document, we intentionally put two spaces after every sentence for line breaks, but the VS editor will trim the white spaces on saving.
Add here because the UI setting doesn’t work even if unchecked. Maybe it was the before-and-after thingy that got overwritten, but this settings.json overwrites everything, and it works.
Topic
phpMyAdmin – Failed to set session cookie
Source
phpMyAdmin > Log in page
Error
When trying to log in first time, the page returns “Failed to set session cookie. Maybe you are using HTTP instead of HTTPS to access phpMyAdmin”
Solution
$ sudo apt install php-mbstring php-zip php-gd
Remark
This error can occur during migration to a new VM even though phpMyAdmin files, configs, and Nginx sites are migrated, and it has nothing to do with HTTPS. Solution is to install the required PHP packages as shown in How To Install phpMyAdmin From Source on Debian 10
This post is not the end, for we will continue to add more troubleshooting guides as we continue our exploration with DevOps tools.