I have already specified port 8080 for my jhipster apps during the initialization of the apps at the beginning when creating them with yo jhipster.
Now, I would like to know how I can change the port 8080 so I can run several apps at the same time.
2 alternatives:
Edit .yo-rc.json file, change or add serverPort property like "serverPort": "8100", then re-generate your app with jhipster --with-entities if you did not make many changes or use jhipster upgrade --force if you did.
Change port value in application*.yml files and proxy.conf.json,and probably also in some docker files
Im using visual code, with minimal added code from jhipster generated code. Using jhipster monolithic app (although I have done it with micorservices as well).
I just do command + shift + F to search for all instance of 8080. This helps you search all your files for this instance.
Then chose all the ones with yml files yo-rc.json, serverPorts, procy.conf.json, docker files, webpackdev etc... that pertains to port 8080 and change them to 8181 or other port number.
Hope this helps as well.
If can do it manual, you change 3 files
application-*.yml : the server port
proxy.conf.json
webpack.dev.js
If you use docker for deploiement, you must change file in doker folder.
in .yo-rc.json file, change serverPort property "serverPort": "8081",
then run jhipster --with-entities
Related
I have a project in gatsby which uses Node.js/express for backend with MySQL.
Now, I know that all I have to do is gatsby build and that will create the static html/css/js files for me in the project/public folder and I can paste all of them in public_html folder and that will work(it is working), but Im confused about the database thing:
My issue is that in the gatsby-config.js when I change the mySql connection from localhost to the hosted db settings such as:
(The commented one is the hosted db configurations)
If I run gatsby develop while uncommenting the code. It says No such DB Error(obviously). So How can I configure the db settings here and also in the gatsby-node.js file to connect the db with the project?
I know this might sound like a dumb question but please help as I'm confused about what to do next.
Thanks.
Okay! Spent a lot of time on this. Hope it will help others.
Static Gatsby site
If you're trying to host a static gatsby site on any shared hosting. By static, I mean just plain gatsby styled pages,
You can do as the gatsby doc says:
Run : gatsby build or npm run build.
According to gatsby:
Gatsby will perform an optimized production build for your site, generating static HTML and per-route JavaScript code bundles.
After this : try npm run serve.
According to gatsby :
Gatsby starts a local HTML server for testing your built site. Remember to build your site using gatsby build before using this command.
serve will test your build files(newly created files in yourprojectroot/public dir)
This will run your project(using the build files) on a test server(localhost:9000) to basically test your build files.
Test this localhost:9000, If everything is working good. You can go to your remote cPanel and paste all your build files into the public_html folder.
Head over to your domain and you're good to go.
Gatsby with MySQL and Node/express
If you are trying to host your gatsby site which works a little with node and mysql as well and you are a newbie in hosting like me, Here's what you'll want to do:
Try both the points mentioned above. (Build your static files and try serve)
Setup your db on the remote as well with the same name dbname, username and password as your local one.
Two extra things:
Now, what you are going to do is to run both the node and gatsby(webpack) servers on the same port (say 8001). So we are going to use only the node server and serve all our gatsby files(build files) as static content to node server.
In your node file, add:
app.use(express.static(path.join(__dirname, 'public')));
app.get('/*', function(req,res) {
res.sendFile(path.join(__dirname,'public/index.html'));
});
As you are going to run all your gatsby pages through index.html the last get('/*'... (above) will take care of all the pages request. Change the path public according to your remote folder structure
Add the build files along with the node(server connection) file in the public_html folder on remote.
Next add or change your .htaccess file (in the remote) to :
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:8001/ [P,L]
RewriteRule ^(.*)$ http://127.0.0.1:8001/$1 [P,L]
So when you run your node file through the server's terminal, instead of yourdomainname.com:8001 the above mentioned .htaccess will redirect it to yourdomainame.com only
All done.
Your public_html now should contain the build files,a node/express conn file and .htaccess file.
Now, just go to your terminal. cd into public_html and run node yournodefilename.
You can head over to your domain now.
Note : You can use pm2 package to keep your node server always running.
Hope it helps somebody.
You should use environment variables to switch between configurations (locally and production). Environment files are files that store sensitive data such as API keys, tokens, etc, so they must be ignored and untracked to avoid pushing critical data to a public repository.
By default, Gatsby uses .env.development and env.production respectively for gasby develop and gatsby build commands, of course, you can override this behaviour but, assuming the default configuration, you should add the following snippet to your gatsby-config.js:
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
Then, you need to create a .env.development and .env.production in the root of your project with the following content:
DB_HOST:yourHost
DB_USER:yourUserName
DB_PASSWORD:yourPassword
DB_NAME:youDatabaseName
Of course, each file should have different variables if you want to switch between databases or configurations.
Add them to your gatsby-config.js:
connectionDetails:{
host: process.env.DB_HOST
user: process.env.DB_USER
password: process.env.DB_PASSWORD
database: process.env.DB_NAME
}
The final step is to add, in your host, the environment file in order to make them accessible by Gatsby. S3 by Amazon allows to configure them but I guess that it's a common configuration for the hostings.
I've several Cordova projects.
When I installed all this, I didn’t understand very well what I was doing.
Now I always have some kind of project on the localhost:8080 and I don’t know how to stop it.
When I run the project from the folder. I can not open it (I did't see it).
npm run dev
How can I change the port to start a new project?
Is it possible to stop the project at port 8080?
Thank you.
It's easy!
Go to the /build folder in your framework7 project in webpack.config.js add the lines in devServer like this:
devServer:{
hot:true,
//host: 'your ip', /* it's optional */
port:80,
In my case, i set the ip and create a one entry A in cloudflare to test over ssl.
I am setting up a new React app on EC2 instance (ubuntu). I have installed nodeJS and npm and I am able to build my app successfully.
Issue is my code is in /var/www/html folder and my site example.com is pointed to this folder.
when I run
npm run build
It builds a folder under /html like /html/build now my app runs on example.com/build. Resources for these files comes from example.com/static/style.css etc but they actually reside under example.com/build/static
I can edit asset-manifest.json and change the path but thats not appropriate solution as I need to get rid of /build folder for production
I am not super familiar with deployments to EC2 but this looks like you just need to either copy the entire contents of your app inside var/www/html, or you need to tell apache or nginx to look to the right folder (in this case /build)
For example, with apache you probably have a file inside /etc/apache2/sites-enabled/ that is pointing to /var/www/html, you could change that to /var/www/html/build and restart apache.
You can check this for examples on how to write these configurations https://gist.github.com/rambabusaravanan/578df6d2486a32c3e7dc50a4201adca4
First, i googled about the issue, but couldn't find anything.
Issue:
On installation, i changed the port to 8081. But now its used by another app. So, is there any way to change port of upsource? (Linux)
This is the correct way.
1. ./bin/upsource.sh stop
2../bin/upsource.sh configure --base-url=http://(server-name).com:(port) --listen-port=(port)
3. ./bin/upsource.sh start
4. Head to http://(server-name).com:(port)
You can run the following from your terminal:
./bin/upsource.sh configure --listen-port 1111 --base-url http://servername:1111/
Substituting "1111" for the port you want to use and 'servername' with the baseurl you have chosen for upsource (in my case this was the name of my machine).
Source: https://www.jetbrains.com/help/upsource/2.5/moving-your-upsource-installation-to-another-server.html
I know this question is Linux specific, but if you're running Upsource on Windows... the commands in #Wassim Seifeddine's answer can be modified to the following to accomplish port and/or base-url updates for Upsource as shown below:
[upsource-base-path]/bin/upsource.bat stop
[upsource-base-path]/bin/upsource.bat configure --base-url=http://(server-name).com:(port) --listen-port=(port)
[upsource-base-path]/bin/upsource.bat start
I have taken a Angular App which works on Local host when I use visual studio IIE server.
I don't want to use Visual Studio and I am trying to test the app locally using XAMPP.
I am a complete beginner, and I cannot get the local host to pick-up the html initialization file. I have checked the following:
Skype is off and the port is set to 80 in XAMMP
the root server in HTTPd.conf is setup correctly (no slash at end)
I am getting a little confused as to 'how' angular will work on the XAMMP local host.
Do I need to get Yeoman or grunt (seen these apps in some posts, but they seem to be for command line environment).
Any help, or even a pointer to a step by step set-up would be great!
Angular is no different from a normal html web page, when it comes to working in a localhost.
Does your XAMPP work with standard HTML files?
Do you have any error generated?
OK. Got this sorted. I was over complicating things entirely, angular runs sweet on regular XAMPP, no Grunt/ Yeoman etc. required.
All you need to do is: 1. install XAMPP 2. Close Skype 3. Place you app, libraries and everything else in the folder C:\xampp\htdocs\
localhost/Angularappstartpage.html
BOOM!
it works.
You may need to adjust the port number on the localhost (default is 80 e.g. localhost:80/...)
You can also change the root folder in your XAMPP config setup to point to your local GIT.
Do this by changing the line in the HTTPD.conf file (click 'config' on the apache module)
DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/myLocalGIT"
Hopefully this will help all the new guys out there. Good luck!
Skype blocks the port 80, which is used for browsing. XAMPP uses the same port so exactly.
https://support.skype.com/en/faq/FA148/which-ports-need-to-be-open-to-use-skype-for-windows-desktop
If you use mysql, also open first XAMPP and start your services and then keep working on your SO as always.