Developing GatsbyJs site on a server - terminal

One of my domain *****.com is hosted on a shared hosting server (Linux) with CPanel. Lately, I have installed NodeJs and GatsbyJs on my server. I have created a gatsby project there (which I already developed on my localhost and is working). Now the issue is- when I run "gatsby develop" command on my server terminal, it creates a development server successfully but I am not able to access it because the access URL is "http://localhost:8000" while I am working on *****.com. I have tried "gatsby develop -H *****.com", "gatsby develop -H " and "gatsby develop -H 0.0.0.0" but can't access. Can anyone suggest a solution for this?enter image description here

Related

How to run web based Postman collection with Newman, on HTTPS protocol

I'm trying to run a collection from a free webhosting text files and I can run it easily with:
newman run %https://mysite.txt%
Now I'm trying to locally capture the sent requests from the newman run so I'm adding this command in CMD:
set HTTP_PROXY=127.0.0.1:62248
this should allow my app to record requests from Newman when using it like that:
newman run %https://mysite.txt% --env-var HTTP_PROXY --insecure
(it works perfect on local hosted files)
However since the txt file is hosted by https protocol, I'm getting the following error:
error: collection could not be loaded
unable to fetch data from url "https://mysite.txt"
tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 62248
Can I run Newman collection from a secure https web address while locally recording it, or should I download and save it first locally and then run it locally?
My current temporary(hopefully I'll get a better one), is to download the file from wherever it's being stored, and run Newman locally with the downloaded file.

how to deploy python3 django2 website on aws ec2 with mysql

I never hosted any website before may be thats why this task became so tough for me.I searched various codes for deployment but wasn't able to host my website.
i used python 3.6.4 and django 2.0.2 with mysql database for my website. It would be a great help if i get steps from scratch for deployment with my requirements.
Thanks in advance!
Below are the basic steps to host your django website on any linux based server.
1) Create requirements.txt file which will include all your pip packages.
On your local enviroment just do pip freeze. It will show you something as below. Include those package to your file.
Django==1.11.15
pkg-resources==0.0.0
pytz==2018.5
2) Create virtual env on your ec2 amazon instance. You can follow same step give on below website.
https://docs.python-guide.org/dev/virtualenvs/
3) Install you local packages to this virtual env.
4) If you have mysql as backend you can install mysql with below command
sudo apt-get install mysql*
Or you can use RDS (Amazon Relational Database Service)
5) Check if you django is able to connect to mysql using below command
python manage.py check
6) If above command work without error, You need to install two things.
1) Application server
2) Web server
7) You can use any Application server like uwsgi, gunicorn
https://uwsgi-docs.readthedocs.io/en/latest/
https://gunicorn.org/
8) Web server will be nginx
https://nginx.org/en/
9) For you static file you will need Bucket. You need to create bucket and host you static files their.
You can find help online to achieve above steps.

How to host a Laravel website on Netlify?

I'm trying to host my Laravel website on Netlify.
I was originally using Laravel Forge to deploy and host my website.
The deploy script that was used on Laravel forge was:
cd /home/forge/lucaban.com
git pull origin master
composer install --no-interaction --prefer-dist --optimize-autoloader
echo "" | sudo -S service php7.1-fpm reload
if [ -f artisan ]
then
php artisan migrate --force
fi
Is there any way I can host the website on Netlify and run these composer commands? Because I think I can only insert NodeJS commands into the build command input.
I have not yet succeeded getting my website live...
You cannot host a laravel site on Netlify. Check out https://jamstack.org for more about the philosophy behind Netlify's hosting service.
While you can use php in the build environment (composer install should work, though you may want to set PHP_VERSION to 7.2 since the default is 5.6), the build process is intended to create static output files - html, css, js, images, etc - which Netlify can then serve from its CDN without running any more code on the server side. While the comparison is not quite perfect, imagine that the output from your build (limited to 15 minutes and no incoming network connections) is a bunch of files, which are stored on S3 and served as-is. So if you end up with file.php - Netlify would show, not run, the code in the file.
You cannot host a laravel, wordpress, drupal, magento, etc site on Netlify, though it is Netlify and the JAMstack movement's assertion that you don't need a legacy website that runs code at every visit to run much of the web and that there is great value in reducing the dynamic portions of a website to small services, such as form-handling or lambda functions. Here's a case study on a customer who migrated their site from wordpress to Netlify and includes authentication, comments, and e-commerce: https://www.netlify.com/blog/2017/03/16/smashing-magazine-just-got-10x-faster/
You may want to have look at Vapor which is a serverless deployment platform for Laravel:
https://vapor.laravel.com

Lumen not working out of the box

Just installed Lumen framework.
hit the link http://localhost/lumen/public/ in my browser and got this following error, anyone got any idea about it?
Traced it back to the app.php file in bootstrap folder.
if You want to access lumen project without "php artisan serve"
$app->run(); replace with
$request = Illuminate\Http\Request::capture();
$app->run($request);
from this path yourlumenproject/public/index.php
Open your terminal in the root folder run the following command php artisan serve.
Lumen development server started on http://localhost:8000/
if you want to serve your app in local development you can do this :
php -S localhost:8000 -t public/
and it will serve in localhost in port 8000. hope this help.
Note : I'm using Laravel Framework version Lumen (5.2.4) (Laravel Components 5.2.*)
At the moment Lumen only runs in the domain root.
(I've submitted a PR that fixes this but it has yet to be merged)
You have to create a Virtual Host on your local webserver and point the document root of that to the public directory. After that you can access your app with something like: http://lumen.dev.
Guide for Virtual Hosts with nginx
Guide for Virtual Hosts with Apache
A simple alternative to setting this up manually is Laravel Homestead. It is an official Vagrant box made for Laravel, that allows you to easily get your development environment up and running.

Deploying Django to Heroku using a Windows machine (Production server NOT development server)

I use a Windows machine and have a Django project that I have successfully deployed to Heroku, albeit using the development server. To use a production server Heroku seems to require 'Gunicorn' which does not run on Windows.
This is not good for testing locally before deploying. Does anyone know of any way to get around this? Perhaps some way to use a different server on Heroku?
I found a solution that may help when deploying to heroku using a Windows machine. Here is what I do:
Use the development server locally with:
python manage.py runserver
Install and add 'Gunicorn' to your installed apps in settings.py.
Add a process file in the root directory that tells heroku to use the Gunicorn server. This is a file called 'Procfile' with the following code:
web: python kalail/manage.py run_gunicorn --bind=0.0.0.0:$PORT
This way you test using the development server, while heroku uses the Gunicorn server. Make sure you set up serving static files(css/js/imgs) after this, because only the development server automatically serves static files, and the Gunicorn server will need to be configured to do so.
You can run the development server locally quite easily:
> python manage.py runserver
All you need to do is specify path to wsgi script from root directory:
$web: gunicorn hellodjango.wsgi

Resources