词汇:can

n. 罐头,一罐;金属容器

相关场景

We're not gonna change that for this little example, but now let's check in that PWA files, and then let's deploy to production one more time. and as you can see, look in the top right corner, when I reload it, we now have that little install icon in Chrome. and if I click that little install icon, I'm gonna get this prompt, and boom! I have a PWA running in production for my Rails application.
>> Rails 8.0.1 You are in good company
And it's gonna refer to an icon, by default,we just have a nice red dot.but you should obviously replace that with your application. And if I hop in and have a look at the service worker, it is sort of already set up for doing we push,just as an example here, having some listeners, you can tweak that as you see fit.
它将指向一个图标,默认情况下,我们只有一个漂亮的红点。但你显然应该用你的应用程序替换它。如果我跳进去看看服务工作者,它已经为我们推送做了准备,就像这里的一个例子,有一些监听器,你可以根据需要进行调整。
>> Rails 8.0.1 You are in good company
We're gonna turn the manifest on in our route file as well. There are basically two lines here as you can see, there's a manifest, and there's a service worker that you can use for your PWA.
>> Rails 8.0.1 You are in good company
we're gonna create a link reference here to manifest just exists here as a comment that you can reference. We're gonna turn the manifest on in our route file as well.
>> Rails 8.0.1 You are in good company
SO now, we're created that user in production using our Kamal consol! I can log in with that user/pasword.
>> Rails 8.0.1 You are in good company
Kamal console:
Kamal also gives you a way to start a console on the server side that is just like the console I showed you earlier that ran in development! You can see here, it reminds you that you are in production.
>> Rails 8.0.1 You are in good company
All right , let's save that and hop back,and see a reload here, now, we have a sign out button, and we can sign out, and that's all it should be. let's deploy this to production, we're gonna just check this thing into Git, deploy it straight to production, go back to our alpha.software...Oops! That didn't work. Why did that not work?
>> Rails 8.0.1 You are in good company
Now, let's add a way to sign out to the main layout here. we can add that with a button to sign out.it's gonna hit the session path, and it's gonna use a method of delete that session if we're authenticated, as you can see there.
>> Rails 8.0.1 You are in good company
As we edit a new dependency, we can hop back in ,reload, and now we're good to go here. as you can see, I first tried to put in a wrong password, we're gonna get this screen, try another email address or password.
>> Rails 8.0.1 You are in good company
If we hop to the session, you can see it just is very basic Rails active record. Now we're gonna set up a default user that the systems should have as we're working with it to allow us to log in since we don't have that signup flow.
>> Rails 8.0.1 You are in good company
And then, we are going to hop in here and have a look at what was actually generated. We have the sessions controller, that's probably the most important. You can see here, it allows unauthenticated access to just new and create.
>> Rails 8.0.1 You are in good company
But as you can see here, it adds a handful of migrations, one for users, and one for sessions! So, we're gonna run rails db:migrate again!
>> Rails 8.0.1 You are in good company
By default, Kamal will use a docker volume to start these things up, but of course, you can configure that, and as I said, you can use S3 if you'd like as well.
>> Rails 8.0.1 You are in good company
If we go back here and reload not in production, boom! We are live in production with our whole setup, everything is working, we can upload the active storage files directly to it.
>> Rails 8.0.1 You are in good company
We can save that, check in that save change, and then we can run Kamal deploy again! gcam 'Set root to app';kamal deploy;
>> Rails 8.0.1 You are in good company
So in production, you actually need to manually specify the route. So we can go down here, and uncomment this, that sets what the route is going to be, we're just gonna point it to post stud index.
>> Rails 8.0.1 You are in good company
Now, we can hop back in here and go to alphaexitsoftware.io and see....whoops!
>> Rails 8.0.1 You are in good company
And as you can see here, I sped things up a little bit, but it was about 80 seconds on my linux machine from a cold boot to do that.
>> Rails 8.0.1 You are in good company
kamal setup:
But this is all we basically need, we are now ready to check in the entire project into Git! Kamal uses Git for keeping track of versions, and we can now run Kamal setup!
>> Rails 8.0.1 You are in good company
And you can pull that password from a bunch of different places, you can pull it from a credential store like one password, you can pull it straight out of Github command, as you can see here with the Github token above, or you can pull things out of ENV.
>> Rails 8.0.1 You are in good company
Now I'm gonna deploy this on my own little hoppy server. And that hoppy server is currently wiped. it is completely clean, and Ubuntu 24.04 setup that has nothing on it already, this is part of the magic of Kamal, you can spin up a new VM anywhere in the cloud or use your own hardware and point Kamal straight to it, and you'll be going in no time!
>> Rails 8.0.1 You are in good company
Docker Hub:
And there's a default configuration file in config/deploy.yml that we can use, it's prefilled a little bit, it has the service name of the name of reaction, but we need to rename, for example, your user,the name of the image to go to my name of where I store this on Docker Hub. You can see we change that down in the registry as well and the name of the container image.
>> Rails 8.0.1 You are in good company
And that is basically it. Now if I go over here and I add a comment to one of these, you see the comment was added on the left immediately at the same time. That's all web sockets automatically happening through action cable. And we can do it , of course the other way as well.
>> Rails 8.0.1 You are in good company
And if we hop into our comment, we can set up a broadcast_to for that post. The broadcast_to will broadcast all update made to that comment, whether a new comment is updated or an existing comment is changed in some way or even one deleted, and send it back out to a channel on action cable named after the post association that this comment belongs to!
>> Rails 8.0.1 You are in good company
When it is nested, we get the fact that it's gonna be slash post slash on slash comments, and we have the association is set up nicely. Now, let's reload! Now it works, we have our comments field underneath. we can add the first comment. And as you can see here, this is my first comment a second ago that was the local time doing its time ago conversion.
当它被嵌套时,我们得到的事实是,它将是斜线后斜线对斜线注释,并且我们已经很好地建立了关联。现在,让我们重新加载!现在它工作了,我们在下面有我们的评论字段。我们可以添加第一条评论。正如你在这里看到的,这是我一秒钟前的第一条评论,当时当地时间正在进行时间转换。
>> Rails 8.0.1 You are in good company