How to configure database in Baeldung spring-security-registration application? - spring-security

I am trying to train myself on Spring security and started looking at Baeldung.com website and examples posted for public download at github repository https://github.com/Baeldung/spring-security-registration. I downloaded the source code in this repository as ZIP and imported in netbeans. Following the instructions in README.md, I built it using mvn clean install. Application spring-security-login-and-registration downloaded all dependencies and built clean. But I don't have a clue how to configure the MySQL database needed for this application.
Do I need to download MySQL server and have a server instance on my localhost?
If yes, where would I get the scripts to create the schema/tables needed in the security application? I can't find the scripts anywhere in source code. Anything similar to hSQL going on here?
Any help is appreciated.

Yes you need to download MySql from here https://dev.mysql.com/downloads/windows/installer/8.0.html.
And need to configure few things during installation like username and password.
And update these fields inside you database properties file.
################### DataSource Configuration ##########################
jdbc.driverClassName=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/YourDatabaseName?createDatabaseIfNotExist=true
jdbc.user=YourUserNameForMySql
jdbc.pass=PasswordHere
You can start you mysql on windows by executing this command:-
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe" on command prompt
Meanwhile you can login to mysql shell using this below command on terminal:-
mysql -uroot -proot

Related

Bazel internal shell issue using windows

I am trying to migrate a huge project having visual studio and maven projects to bazel. I need to access our in house maven server which is encrypted. To get access I need the load the maven_jar skylark extension since the default impl does not support encryption (get error 401). using the extension leads to a lot of troubles, like:
ERROR: BUILD:4:1: no such package '#org_bouncycastle_bcpkix_jdk15on//jar': Traceback (most recent call last):
File ".../external/bazel_tools/tools/build_defs/repo/maven_rules.bzl", line 280
_maven_artifact_impl(ctx, "jar", _maven_jar_build_file_te...)
File ".../external/bazel_tools/tools/build_defs/repo/maven_rules.bzl", line 248, in _maven_artifact_impl
fail(("%s: Failed to create dirs in e...))
org_bouncycastle_bcpkix_jdk15on: Failed to create dirs in execution root.
The main issue seems to be the shell that needs to be provided to bazel in BAZEL_SH environment variables:
I am working under windows
I am using bazel 0.23.2
bazel seems to run a bash command using "bash" directly and not the one provided by env variable.
I got a ubuntu shell installed in windows. bazel was using everything from ubuntu, especially when using maven (settings.xml was using from ubuntu ~/.m2 and not from windows user)
after uninstalling ubuntu and making sure that bash in a cmd ends up in "command not found" I also removed the BAZEL_SH env var and bazel throws the message above
after setting the BAZEL_SH variable again it fails with the same error message
I am assuming that bazel gets a bash from somewhere or is ignoring the env variable. My questions are:
1. How to setup a correct shell?
2. Is BAZEL_SH needed when using current version?
For me the doc at bazel website about setup is outdated.
Cheers
Please consider using rules_jvm_external to manage your Maven dependencies. It supports both Windows and private repositories using HTTP Basic Authentication.
For me the doc at bazel website about setup is outdated.
The Bazel team is aware of this and will be updating our docs shortly.

use Google spreadsheet connector wso2

I would like to use the google spreadsheet connector at https://github.com/wso2/esb-connectors/tree/048e223c037b447c3f77c2b7e72338dc26ea5c46/googlespreadsheet. But it is not found in wso2 store. I would like to know how I can compile it and use the connector from github. Please help
Generally git wont allow you to get a folder. so you need to go with svn approach. follow bellow instruction as it is. (assumtion on you are woking in linux / mac enviorment. if not make the command the way works on windows.
create new directory where ever you want and navigate inside that
wget https://raw.githubusercontent.com/wso2/esb-connectors/048e223c037b447c3f77c2b7e72338dc26ea5c46/pom.xml
mkdir wso2
cd wso2
mkdir esbconnector
cd esbconnector/
mkdir googlespreadhseet
cd googlespreadhseet/
svn checkout https://github.com/wso2/esb-connectors/trunk/googlespreadsheet/googlespreadsheet-connector/googlespreadsheet-connector-2.0.0/org.wso2.carbon.connector
cd org.wso2.carbon.connector/
mvn clean install
it may take little time as its required to download few artifacts. if its ended up with error that integration test not found get the integration test Base from the same repo and build that first. then rebuild the connector
Recently Google spreadsheet Version2 connector has been created with REST API and added to WSO2 store. The Connector zip file can be downloaded from here. Go to the link and click the 'download connector' button and follow the documentation for the configuration.
You can checkout the connector source from the https://github.com/wso2/esb-connectors/blob/master/googlespreadsheet and built it.
Then add the connector to the ESB from the UI according to the https://docs.wso2.com/display/ESB481/Managing+Connectors+in+Your+ESB+Instance

Where is GitLab installed on Ubuntu 14.04?

GitLab was installed by following instructions at https://about.gitlab.com/downloads/ on Ubuntu Server 14.04 but I can't find the install directory. It's commonly said to be in /home/git/ or /home/gitlab/ but neither exist.
I need to find the install directory so I can setup SMTP (RE https://gist.github.com/petermanser/6117494) and migrate existing repositories into GitLab.
Does anyone know where GitLab would be installed on Ubuntu Server 14.04 if not /home/git/ or /home/gitlab/?
Config files are in etc/gitlab
Data is stored in /var/opt/gitlab
Thanks to Bjorn for finding the locations and Pavel S for providing cat /etc/passwd | grep git for finding the home directory of a given user!
To find a user's home directory do
$ cd ~git
you will be in that users directory.
:D
There is a Directory structure section in the official README.md file of Omnibus-GitLab repo:
Omnibus-gitlab uses four different directories.
/opt/gitlab holds application code for GitLab and its dependencies.
/var/opt/gitlab holds application data and configuration files that
gitlab-ctl reconfigure writes to.
/var/log/gitlab contains all log data generated by components of
omnibus-gitlab.
/etc/gitlab holds configuration files for omnibus-gitlab. These are
the only files that you should ever have to edit manually.
But, if you install the GitLab alone from source (rarely, but useful for unsupported systems like *BSD). Then the GitLab installation location will be different, and it is described in this official doc.

Neo4j StartService FAILED 1053 after copying Beer DB example

I installed Neo4j as instructed in the site and was able to install and stat server. However I tried to copy the Beer example DB by stopping the server and deleting the current graph.db in the \data folder and replaced with the one Beer example downloaded from online (graph.db folder). This is the only step I did.
Now the issue is, when i tried to start the Server I get "StartService FAILED 1053"
I am using following command on the powershell in windows - c:\neo4j-community-2.0.0-M03> .\bat\Neo4j.bat start
Can someone please help if I have done anything wrong here.
Thank you!
You are running neo4j 2.0 against an older database file. You'll need to set the config parameter to allow the store to be upgraded before starting. See instructions here:
http://docs.neo4j.org/chunked/milestone/deployment-upgrading.html#_explicit_upgrade

git clone problem

i have create clone of project on local machine with
git clone git#github.com:test/abc.git
Now i want to deploy my project on my ubuntu server .
so i have created a script which install git on my ubuntu server.
And now i want to deploy my rails project on server.
like git clone git#github.com:test/abc.git but i have not set ssh key on my server.
Is there any way i can create clone without set up ssh key on my server.
Is compulsotion that we have to create to ssh each on every server?
What if i have 20 server ? i need to set up ssh key for every server to clone?
Is there any way just ask the password than it will create a clone?
Or any other way?
You can use the read-only version. Next to the name of your repository you can select the http protocol. This url can be used without ssh key. If it is a private repository you'll need to add your username to the url.
$ git clone http://myname#github.com:test/abc.git
Initialized empty Git repository in /Users/myname/Projects/abc/.git/
password:
Then you type your password and a bit later you have your clone. A disadvantage is that you need to enter your password if you use a private repo.
Although I fail to see the problem of adding a few ssh-keys. If you really need to deploy to 20 servers you might consider thinking of using a packaging method with good OS support for automatic updating.
It is a mistake to try to use a configuration management tool in order to deploy an installation. Do you really intend to update the code from each of those 20 systems? Why then are you granting them write access to the code?
Create a tarball or use whatever package management systems are available in the language you are developing in (e.g. in Perl, you could use Dist::Zilla, Module::Install or ExtUtils::MakeMaker).
We created a php script which built RPMs (and Using Alien also built DEBs) for updating our 200+ machine fleet. As a url like "http://repo/fetch/rpm/" was called a script checked if there had been a new git tag inserted in package_name repository and if so use an RPM template we created on a per repo basis (typically put in .build/rpm.spec) to build the RPM, save it to a local cache directory and read the contents out as a file header.
I realize for your application that won't work since you're using GitHub - but it's just an idea for those who have their own remote repositories. A cron on the boxes would query once a day those URLs and run rpm -Uvh on the output.
For your instance it might be wise to tarball each release and either put that in a public accessible URL or create a script to rsync it to each server + exec
If you're deploying rails projects, you should check out Capistrano - http://www.capify.org/index.php/Getting_Started

Resources