no remote repository when installing dbweb - mysql

I want to install dbweb to manage a MySQL database server but I get this error in cmd.
I tried to to install that on my go project and get same error.
C:\Users\NakhodaSokoot>go get github.com/go-xorm/dbweb
# cd C:\Users\NakhodaSokoot\go\src\github.com\lunny\nodb; git pull --ff-only
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
package github.com/lunny/nodb/config: exit status 1
# cd C:\Users\NakhodaSokoot\go\src\golang.org\x\crypto; git pull --ff-only
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
package golang.org/x/crypto/scrypt: exit status 1

It gives those errors because github.com/go-xorm/dbweb has dependencies on those other two packages which it cannot update because you have them locally but they have no remote so go get does not know from where to pull the code.
Try removing them:
$ rm -rf $GOPATH\src\github.com\lunny\nodb
$ rm -rf $GOPATH\src\golang.org\x\crypto
Then try to go get your package again:
$ go get -u github.com/go-xorm/dbweb
Or go get them separately and then go get dbweb:
$ go get -u golang.org\x\crypto
$ go get -u github.com\lunny\nodb
$ go get -u github.com/go-xorm/dbweb

Related

Create docker container, execute a script and delete the container

I want a command that, in first, will create a docker container, then execute a sql command on my database and then delete the container when it's done.
For the moment I have this Dockerfile :
FROM ubuntu:18.04
# copy database-file.sh
WORKDIR /database-file
RUN mkdir database-file
COPY * /database-file/
# Update and install mysql-client
RUN apt-get update && apt-get -y install mysql-client
# Prepare database-prepare script to be use
RUN chmod +x ./database-prepare.sh
VOLUME /app/log
# Exec my script
ENTRYPOINT ["./database-prepare.sh"]
I took an Ubuntu image, I don't know if it's the best but for the moment, it's ok i think. I just want to test.
So there is my script :
### Global ./database-prepare.sh ###
#!/bin/bash
# Get service name by Docker secret.
service=$(cat /run/secrets/<society_name>_DATABASE_PREPARE__SERVICE)
# Format the service name.
serviceName=${service//./-}
# Clone the repo of my service
git clone --recurse-submodules git#bitbucket.org:<society_name>/<society_name>.binding.$service.git /$serviceName
# CD in the right folder
cd /$serviceName/build/
# Prepare my script and execute it
chmod +x database-prepare.sh
./database-prepare.sh
Then each service have his own database-prepapre.sh that will create a new user in my database :
### Service ./database-prepare.sh ###
#!/bin/bash
# Get password with Docker secret
<society_name>_MSQL_ROOT_PWD=$(cat /run/secrets/<society_name>_MYSQL_PWD) # My Mysql password
<society_name>_BINDING_ABEEWAY_GENERIC_DBS__<society_name>_DATA__PWD=$(cat /run/secrets/<society_name>_BINDING_ABEEWAY_GENERIC_DBS__<society_name>_DATA__PWD) # My password for this user
mysql -h <society_name>-sql-server.mysql.database.azure.com --user='administrateur#<society_name>-sql-server' --ssl --password=$<society_name>_MYSQL_ROOT_PWD << EOF
DROP USER IF EXISTS '<society_name>.binding.abeeway.generic'#'%';
CREATE USER '<society_name>.binding.abeeway.generic'#'%' IDENTIFIED BY '$<society_name>_BINDING_ABEEWAY_GENERIC_DBS__<society_name>_DATA__PWD';
GRANT SELECT, INSERT ON <society_name>_data.ms_gpsposition TO '<society_name>.binding.abeeway.generic'#'%';
GRANT SELECT, INSERT ON <society_name>_data.ms_log TO '<society_name>.binding.abeeway.generic'#'%';
GRANT SELECT, INSERT ON <society_name>_data.ms_temperature TO '<society_name>.binding.abeeway.generic'#'%';
EOF
And know here is my issue :
./database-prepare.sh: line 6: unexpected EOF while looking for matching `"'
./database-prepare.sh: line 13: syntax error: unexpected end of file
So my error is in the file of my Service, where I have "End Of File" text. I try to execute this code, directly in a running container and there is no problem with the EOF... I don't really know where I make a mistake, I'm a novice in Dockerfile, and I think my mistake it's maybe caused by the Image I took, or I maybe I forgot to install a useful tool to make my script work correctly. Or just my script isn't good .. I don't know.
I hope you have enough information to help me, tell me if you need more.
Thank you very much !
Ps: If you know how to delete my service after he executed his command, I would be grateful ! I work on swarm cluster
I finally find a solution, I rewrite my Dockerfile with another image :
FROM alpine:3.7 # <----- Changed
WORKDIR /database-file
RUN mkdir database-file
COPY * /database-file/
RUN apt-get update && apt-get -y install mysql-client # <----- Deleted
RUN apk add mysql-client # <----- Added
RUN apk add git # <----- Added
RUN apk add openssh-client # <----- Added
RUN chmod +x ./database-prepare.sh
VOLUME /app/log
ENTRYPOINT ["sh","./database-prepare.sh"] # <----- Changed
I think the real problem was my ENTRYPOINT, after reflection I think my old ENTRYPOINT doesn't call correctly my script.
I hope this will help another person.

error: cannot open .git/FETCH_HEAD: Permission denied on gitlab-runner

I'm trying to pull code with gitlab-runner with a shell executor.
$ git pull origin master
error: cannot open .git/FETCH_HEAD: Permission denied
ERROR: Job failed: exit status 1
git status seems to work fine but when I try git fetch
$ git fetch
error: cannot open .git/FETCH_HEAD: Permission denied
ERROR: Job failed: exit status 1
This could be because you did not add a deploy key for your gitlab-runner user in your gitlab project, so the runner user does not have access to your gitlab repository.
You should follow theses steps to create the keypair for gitlab-runner user (the shell executor user) https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-shell-executor
Then copy the created public key in /home/gitlab-runner/.ssh/id_rsa.pub
And add it to your gitlab project's deploy key :
Go to you gitlab project
Settings => Repository
Deploy keys
Add a title, past the public key and click "Add key"
Trigger you CI again and the shell executor runner should be able to pull the repository.
I just solved this problem by running this command
sudo chown -R $(whoami) .git/ in my project directory.
You can change $(whoami) to the username of your server. For example sudo chown -R gitlab-runner .git/
Changing the permissions helped!
sudo chown -R .git/

Unable to install Couchbase sync gateway

I am trying to install Couchbase sync gateway using the steps from the following URL for MacOS
https://developer.couchbase.com/documentation/mobile/current/installation/sync-gateway/index.html
This issue is, i downloaded "couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz" and its in "Downloads" folder in MacBook.
When I execute this command -> sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
[MyMacbook:downloads administrator$ sudo tar -zxvf couchbase-sync-gateway-enterprise_1.4.1-3_x86_64.tar.gz --directory /opt
tar: could not chdir to '/opt']
Throws error as "tar: could not chdir to '/opt'"
I don't understand how to resolve this. I couldn't get help anywhere.
Please help installing Couchbase sync gateway successfully on MacBook.
It dosen't actually matter if /opt does not exist on your Mac. You can either create one before firing the command with the following command:
sudo mkdir /opt
Otherwise, you can replace "opt" with locations like : /Users/< your_user > or /usr/share or /var

MySql Start failed with : 'The server quit without updating PID file (/usr/local/mysql/data/iZ23uaxhiftZ.pid).'

I am installing MySql Server in my Ubuntu. Steps are as the following:
Firt, I download the Linux Gerneric version of mysql: mysql-5.6.27-linux-glibc2.5-x86_64.tar.gz
I untar the downloaded package and copy all the contents to /usr/local/mysql: cp -r mysql-5.6.27-linux-glibc2.5-x86_64 /usr/local/mysql
I add group and user: 'groupadd mysql' and 'useradd -r -g mysql mysql'
Then I get into /usr/local/mysql folder, and use: 'chown -R mysql:mysql ./' to make mysql be the owner of the current folder.
Use './scripts/mysql_install_db --user=mysql' for installing MySql database. Then I added owner using 'chown -R root:root ./' and 'chown -R mysql:mysql data
I try to start MySql using 'support-files/mysql.server start', it tried to start the db but failed with error:
I could not find any .pid file in data folder:
but just a 'iZ23uaxhiftZ.err' file:
I have tried some solutions provided on the Internet, but get no luck, so how can I solve this? Thank!

How do I update phpMyAdmin in Ubuntu?

I have an old phpMyAdmin installation (contains my training and jobs data). I want to update it to the latest version and I want to keep my data safe while updating it. Is there any way to do it by running some commands on the terminal? Is my data erased if I uninstall phpMyAdmin?
Here is how to upgrade/downgrade on Ubuntu.
Note: The following instruction only works if you previously (and correctly) installed phpMyAdmin with the command line and use APACHE as a web server.
I suppose that you already have a working phpMyAdmin, but the version isn't the one you want. For instance, Ubuntu is shipping the 4.6.x version which doesn't work properly with PHP 7.2.
Check the version you want on:
https://www.phpmyadmin.net/files/
On your server
cd /usr/share/
rm -rf phpmyadmin
then adapt this line with the correct version number
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0/phpMyAdmin-4.8.0-all-languages.zip
unzip phpMyAdmin-4.8.0-all-languages.zip
rm phpMyAdmin-4.8.0-all-languages.zip
mv phpMyAdmin-4.8.0-all-languages phpmyadmin
Note: If unzip don't work, install it with: sudo apt-get install unzip
Check permissions
Now you should be good.
The owner of /usr/share/phpmyadmin should be root:root on a default installation. This should be fine but if you face some permissions issues, you can try to let Apache be the owner:
# only if you have permissions issues
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
You can also restart Apache
sudo service apache2 reload
Troubleshooting
Note: Depending on your PHP version, you may need to install additional libraries.
For example, to resolve the error about missing mysqli and mysql extensions (update the command to reflect your PHP version):
sudo apt-get install php5.6-mysql
phpmyadmin is mysql client, so it will not affect your database if you uninstall phpmyadmin.
I update phpmyadmin by using terminal commands:
First you have to add repository to get phpmyadmin :
sudo add-apt-repository ppa:nijel/phpmyadmin;
and then update it to get the latest version of software in repositories :
sudo apt-get update;
after that, you can get it (install, you need to uninstall the older version first if you have) :
sudo apt-get install phpmyadmin;
Oh, make sure you are connected to the internet
Using ubuntu? i think it will be better if you ask it in ubuntu forum.
may it helps
------ UPDATE -------
If you find the phpmyadmin version you get from ppa is not the latest one, you can find the latest version here and install it manually (not from repo).
Downloaded phpmyadmin can be installed in /var/www/html/ or in your working directory (public_html or something you've defined). Just extract the zip and move extracted folder to /var/www/html/. And don't forget to change the permission of the phpmyadmin folder to 777(it may not safe, but works fine).
Here is the how:
extract downloaded file
unzip phpMyAdmin-4.6.6-all-languages.zip
move to /var/www/html/, you might need sudo.
if you're not sudoer, move it into your working directory (e.g. public_html), and rename the folder to 'phpmyadmin'
sudo mv phpMyAdmin-4.6.6-all-languages /var/www/html/phpmyadmin
change the permission
sudo chmod 777 -R /var/www/html/phpmyadmin
and then you can access phpmyadmin via http://localhost/phpmyadmin.
If you put the phpmyadmin in public_html, you might want to create a symlink into it from /var/www/html, so you can access phpmyadmin as usual.
phpMyAdmin is only client for MySQL database, it doesn't contain your data. It's all saved in database, so nothing will be deleted even if you delete phpMyAdmin.
To update phpMyAdmin from repository you can follow steps from this thread.
1- check your phpmyadmin version from GUI.
2- Download Latest version of phpMyAdmin HERE
Use the below command to download the latest version of phpMyAdmin into /opt or /usr/src directory
# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.zip
Notes to install unzip package: apt-get install unzip
# unzip phpMyAdmin-4.8.3-all-languages.zip
3- Find phpMyAdmin Installation Directory
Use the below command to search the phpMyAdmin Installation Directory on your system
# /usr/share/phpMyAdmin
4- Remove/Delete phpMyAdmin content
/usr/share/phpmyadmin is correct phpMyAdmin installation directory, Just Delete/Remove everything from that directory
# cd /usr/share/phpMyAdmin/
# rm -Rf *
5- Move/Copy New phpMyAdmin content
Use the below command to copy all the new phpMyAdmin content to /usr/share/phpmyadmin.
# cd /opt/phpMyAdmin-4.8.3-all-languages
# mv * /usr/share/phpMyAdmin/
6- Restart Apache, MySQL or MariaDB service.
Start/Restart the service in SysVinit Systeme
# service restart httpd
# service restart mysql
Start/Restart the service in Systemd Systeme
# systemctl restart httpd.service
# systemctl restart mariadb.service
7- Now Check New version of phpMyAdmin
Navigate your browser to http://localhost/phpmyadmin, Now you are using latest version 4.8.3 of phpMyAdmin.
Reference
sudo su
cd /usr/share/
rm -rf phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-all-languages.zip
unzip phpMyAdmin-4.8.4-all-languages.zip
mv phpMyAdmin-4.8.4-all-languages phpmyadmin
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
sudo service apache2 reload