Capistrano SSH Connection - php

I am trying to use capistrano to deploy my php application to a server. For versionising the code, I am using GIT in combination with Bitbucket.
For CI process, I am using jenkins on a virtual machine with ip 192.168.65.68. When I develop on another virtual machine, I push changes to this machine and the CI process starts - this is working. Now I wanted to go one step ahead and use Capistrano to deploy the app (first to a new folder on the same CI machine). Within deploy.rb file of my project, I tried to connect with ssh to the project by using the same options I provide within jenkins to connect (192.168.65.68 = localhost):
set :repo_url, 'ssh://git#192.168.65.68:7999/nav/myrepo.git'
set :ssh_user, 'jenkins'
When I run "cap production deploy --trace", I get a connection error that the connection got blocked.
So my question is: Is my attempt to connect from the CI machine to the Bitbucket repo completely wrong? How do you connect via ssh to your repo and fetch the source code when using capistrano?

Related

Access denied to database while calling docker from command line

I took responsibility for a hughe project, a part of the project contains cronjobs to crawl data from a certain provider.
The project is written in Yii2 and it runs in Lando enviroment with docker desktop, on a windows10 machine with wsl2.
While working with the database container in phpmyadmin or in the browser everything connects nicely and runs fine. But if I try to call the cron from my windows or wsl console, I'm not able to connect to the database. (SQLSTATE[HY000] [1045] Access denied for user xxx#localhost, thrown by DB connector). The credentials are definitively valid, I'm using them all the time. The appserver container can communicate with the database.
I guess it has something to do with permissions windows host -> docker but I can't figure out where I have to change this this in docker or in lando (I'm not really experienced in docker unfortunately).
Any help or trick is welcome!

How to setup Laravel application in AWS Elastic Beanstalk using external RDS database

I want to start deploying my laravel app to production. To avoid changing AWS config in the near future, I decided to try to add continuous integration. To do this I'm using elastic beanstalk and pushing the code there using another AWS tool. All this is working perfectly. I put a test message in /public/index.php to output "hello world" and it works as expected when going to the URL. When I remove this text and run my laravel app as normal, I get a 500 internal server error. I'm not sure all what elastic beanstalk does on deployment for laravel apps. Because of this I'm not sure if this error is occurring from a bad DB connection or laravel app not fully setup yet.
I created an RDS DB instance outside of elastic beanstalk. I am able to access this from sequel pro and I added the database I will use to store all my data. I added all the necessary db connection values (host, port, database, username, password) to /config/database.php and the elastic beanstalk server configuration environment variables.
I've searched online for days for info but haven't found anything specific to this. Also part of my issue is a lack of understanding of how laravel is setup during a deployment in beanstalk. Is there something with /.ebextensions that will help me accomplish these goals?
When I deploy my code I need to make sure all vendor files are installed through composer and then I also need to make sure all database migrations/changes happen. I want to automate as many steps as possible so I can just push up code changes and server will change code and keep working.
I also want to make sure there isn't anything I'm missing for setting up my db connection. Are there any other files in laravel I need to setup or something in elastic beanstalk I need to have configured? I'm keeping my db open to all connections and then I can tighten restrictions later
EDIT: My database may not be configured correctly yet, but that appers to not be source of the issue. I think my issue is knowing what scripts and how to run them during deployment. I want to make sure composer and php artisan migrate is ran to keep everything up to date. How can I do this with elastic beanstalk?
This is a little off topic but with my experience I do not recommend using beanstalk to achieve a good workflow pushing and deploying. I recommend
you to use Forgelaravel.com to deploy your GitHub repository. In forge Laravel you will be able to create a server from AWS and it will automatically create database connections and stuffs, then with just one click you can deploy to the server and keep a good workflow.
Given that we're speaking of a Laravel application, this 500 Server Error
often occurs when one is creating new infrastructure. Why? It's likely to forget to add the environment variables to the EB environment.
Simply go to that EB environment configuration, then under software modify to include at least the following environment properties
APP_DEBUG (can be, for example, false)
APP_KEY (this is the key generated with php artisan key:generate)
APP_NAME (tiagoPeres)
Then the issue will be gone.

How to deploy a PHP application from ec2 instance?

I have created an ec2 instance and I need to deploy my php-yii application on it. I have uploaded the entire code base to the server and I have connected it with my RDS instance holding my MYSQL database. I have setup a LAMP stack for the server. I have also configured the Network Interfaces and Security Groups and I'm able to access my files in the server from outside.
How will I deploy my yii application in this setup? Should I use beanstalk for this?
Move the application to the /var/www/html folder and it launches automatically. Also remove the index.html already present in that folder.

In Symfony 3 app deployed to AWS Elastic Beanstalk, why does database work in dev environment but not in prod?

I'm a newbie when it comes to AWS, and I'm trying to deploy an application to AWS Elastic Beanstalk for the first time. I've set up a database in the EB console for my environment, and updated the parameters.yml file to include the correct credentials. My application is using Symfony 3.
When I access a page that does not interact with the database, it works just fine in both dev and prod environment. Once I open a page that attempts to open a connection to database in prod, I get a 500 error. However, if I go to app_dev.php first, then open the same page, it reads from the database just fine. When I check the log files, I'm getting a "connected refused" error from attempting to open the page in prod.
Why does dev environment connect to database, but prod doesn't? Is there another configuration I'm forgetting to update?

How to check instance is running in heroku

I am creating a website on PHP.
I have cloned the source code. using git clone
Create an app on Heroku heroku create and deployed my code on heroku using command git push heroku master.
Now i want to check either my instance is running or not. How to check?
Thanks for your time.
You can run heroku open, which will open your app in your default web browser. Of course you can also manually navigate to your app's URL, which should be be https://<your-app-name>.herokuapp.com.
You can also run heroku ps which will show your app's dynos and their status.
Both of these heroku commands accept an --app argument in case you want to run them from outside of your project directory or have multiple apps configured.
As stated in official documentation of heroku
Ensure that at least one instance of the app is running:
heroku ps:scale web=1

Categories