تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Configure Forge Deployment0:00

Let's deploy our app. I'm using Laravel Forge and DigitalOcean, but feel free to use any other service that you're comfortable with to deploy your apps. I've already provisioned the server behind the scenes and connected it to my GitHub repo as well as to a subdomain, but we're going to configure some of the things right now. First, let's enable the quick deploy here so that it automatically deploys whenever new changes are pushed to the branch. Then let's modify our deploy script because we need to run npm install and npm run build on every deploy. So we'll do npm install and npm run build, and we also should seed the database with the PlanSeeder to create the plan records for billing. So we'll do forge php artisan db:seed --class=PlanSeeder --force. Now you could just ssh into your server and run this command manually or have it be part of some kind of migration or a command, but I just want to do it here for the first time on the first deployment,

Set Production Environment0:52

you could just ssh into your server and run this command manually or have it be part of some kind of migration or a command, but I just want to do it here for the first time on the first deployment, and after the first deployment we'll remove this line. So let's click update. Next we need to edit some environment variables, so let's go to environment. We're going to change the queue connection from sync to redis, and we also need to paste in some of the environment variables from local. So let's copy all these Shopify related environment variables. Let's go back, paste it here. Let's click save, and actually we do need to update this domain. So let's copy this domain and put it here. Save again. Let's now start the queue worker. So we do need to create a queue worker here. We'll just keep the default settings here. Let's click start worker. That's good, and I think we're good to start deployment. So let's deploy, and while that's deploying we

Update Shopify App URLs1:40

queue worker here. We'll just keep the default settings here. Let's click start worker. That's good, and I think we're good to start deployment. So let's deploy, and while that's deploying we should actually update our URLs in the Shopify partners dashboard. So let's go to partners dashboard. We'll update it here, update this, and also the webhook URLs. So scroll down, change this, this, and this. Let's save. Let's install our app to the development store. So we'll go to overview, select store, install. It's going to bring us to this grant page. Let's click on install app, and then it brings us to this billing page to approve the subscription because we are on the free plan by default, but as you can see the approve button is disabled because it's asking us for payment method. That's because in our plan seeder we have the test set to 1 only if the environment is not production. So what I'll do is that I'll manually edit those plans to be

Fix Production Billing Tests2:31

us for payment method. That's because in our plan seeder we have the test set to one only if the environment is not production. So what I'll do is that I'll manually edit those plans to be test into the production database so that we're able to see our app in production. So let's go back to phpStorm. I already have my production forge database connected to the phpStorm, so we can open the plans here and make changes manually. So we'll set this to test one and this as well to one. Let's update. Let's go back to browser. We need to trigger this again, so we'll go to our app which is gonna try to load it, but it makes the Axios call right away to fetch the premium status and therefore redirects us back to the billing page. Now we have the approve button enabled, so let's click on that, and as you can see we are redirected back to our app, and our app is working as expected. Let's try to create five products. Click generate. This should queue up the job,

Verify App and Queues3:21

so let's click on that, and as you can see we are redirected back to our app, and our app is working as expected. Let's try to create five products. Click generate. This should queue up the job, so let's go to products, and sure enough the five products have been created. Let's go back to our app. We're going to upgrade to premium so that we could create customers. It's going to bring us to the billing page again. Let's approve. That worked. Let's create five customers and five products. This is going to queue up the job as well. Let's check products. We see that products have been created, and customers are in progress of being created because that takes some time. So we have two customers, refresh, and five customers. Let's try to delete all the test data. So we'll go back to app, delete fake data, go back to products. We still have the products because remember that queues up the job, and we have our queue worker running in Forge, so it's going to pick it up

App Store Publishing Process4:10

to app, delete fake data, go back to products. We still have the products because remember that queues up the job, and we have our queue worker running in Forge, so it's going to pick it up and run it. So let's refresh the page. We see that now we're down to two products, and we see that all the fake products have been deleted. Let's check customers, and customers have been deleted as well. All right. So as you can see, we have a working app deployed in production. Next step is to actually publish the app. So let's go to Shopify partners dashboard. We click on choose distribution, and here we have to decide if we want to make this app public within the app store or a single installation link for one merchant or one client. I'm not actually going to publish this app because I don't think it's complete in terms of features, and also it's just a demo app. When you click on this choose Shopify app store, for example, you have to go through some checklist

this app because I don't think it's complete in terms of features, and also it's just a demo app. When you click on this choose Shopify app store, for example, you have to go through some checklist and then draft your listing for which there is a one-time fee. So if I click on create listing, you can see that it's asking for a one-time app store registration fee. You should read through all the requirements as well as list of common app rejection reasons within the Shopify documentation. You'll be communicating with Shopify via email and Zendesk to address some of the changes they might require you to make to have your app approved. You basically just need to follow the instructions that they give you if your app gets rejected and make changes accordingly. There is a nice diagram here detailing the workflow of the app review process. Once you go through the requirements and you're ready to publish, then you submit it for review.

There is a nice diagram here detailing the workflow of the app review process. Once you go through the requirements and you're ready to publish, then you submit it for review and wait for Shopify to either approve or reject and then go from there. All right. So I think that concludes this series. I hope you enjoyed it and hope that you're going to build something cool. We did use Laravel Shopify package in this series, but topics and concepts we covered are transferable to other packages as well. So have fun and until next time, happy coding.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟