can I edite Laravel project from my serveur directly - laravel

I have a website that creates from Laravel. I want to do some customization to that.
Can I edit directly from my server or need anysoftwair or anything else
I need help editing it. How can I do it?
Thank you

You can edit the files directly on your server using any text editor available to you, however, it's not advisable to make changes directly on a live/production environment. What happens if/when you make a mistake or a change has a negative effect (e.g. on performance), how will you revert those changes efficiently and swiftly, and how will you know which file(s) are causing any issue(s)?
Instead create a local environment to make and test your changes, ideally then deploy those changes to a remote staging/development environment for further testing before deploying to your live/production environment.

Related

Odoo - How To Manage & Update Static Files

Static Files in Odoo
I'm new to Odoo, and am working through developing a custom theme for a client. I've worked through the theme tutorial despite the many errors and omissions that exist in that documentation (going to make a pull request to update that after I'm done). My latest struggle is dealing with static files in Odoo, specifically images in the theme.
The Setup
Running Odoo 13.0.20200323 on Ubuntu 18.04 in VirtualBox managed by Vagrant and provisioned with Ansible
The Problem
Changes to image files in the static folder are not reflected on the website. This includes updating the theme in the website theme settings (the update function seems to update everything else). I've changed image names, image content, moved them into other folder, and have not been able to figure out how to have any changes updated on the website. I've restarted the server, doesn't change anything. Updated the theme as stated above, doesn't work. The only way I've been able to have any changes reflected on the front end is to completely destroy and rebuild the server.
Questions
What am I missing? Is there a function I'm not running to trigger Odoo to update what it serves from the static folder?
How does Odoo work with static files in general? On the fly updates to files in the static folder don't seem to have any changes on the front end. Are the files in the static folder copied somewhere else on install, and then served from that other location?
Understanding
I understand that having images and other files change in a folder called static, doesn't make much sense functionally, and that's not my intention for this. Since I'm in development I need to make changes to files, like SCSS, JS, and images, and have those updates reflected on the front end without having to destroy and rebuild the server every time. To be clear, changes to SCSS and JS files that I've registered in .xml files and bundled with various Odoo bundles update just fine when I make changes to them and then update the theme on the backend in the theme management view.
My desire is to understand how Odoo handles the files in the static folder in general, how to update those files properly, and how to manage them while developing and for release.
Answers
I've figured out an answer to the first part of the question as to what I'm doing wrong. It seems like a browser caching issue. When performing a hard reload, empty cache and hard reload, or visiting the site in an incognito window changes are reflected to imagery.
As far as I can tell Odoo is just serving files from the static folder directly. Please correct me if this is not the case.
Follow-up
Does anyone have a good solution for working with changes like this and dealing with browser caching issues?
Answer: I've set up a a couple gulp tasks that use gulp-rev (will replace with gulp-rev-all soon) rev-del and rev-rewrite to handle cache busting through appending hashes to the file names.
I'm going to try setting up Browser-sync in proxy mode to see how that deals with changes to files on reload. I'll report what I find!
Update: Browser-sync has worked well so far as expected. But was kind of useless until I figured out how to work out a fix for the problem below
Does anyone know of how to automate Odoo rebuilding SCSS, JS etc. bundles? So that on file change the theme can be updated and the results seen without having to manually update the theme on the backend to see the results?
Answer: The main task was figuring out how to get live HTML/XML updates working. Which meant building Odoo from the source, and not making any updates or changes to the theme on the backend or frontend from within the Odoo interface. Passing the option --dev xml to Odoo when starting it with odoo-bin allows for the XML code to be evaluated directly, and makes live updates possible. But this extremely helpful (almost necessary) functionality is broken when you make any updates to the them from within Odoo. I'll report on any work arounds to this, but for now as long as I don't touch the theme from within Odoo (update the theme or make edits to it with their editor) then it works great. Also I had to bypass bundling my CSS and JS with their bundler initially to get those updates working live, but may be able to go back and rebundle them now that the code is being evaluated directly.
⭐️Boilerplate and Tutorial Series ⭐️
I'm going to get my whole process for theme building dialed in and then I'll be sharing the boilerplate and build tools on GitHub and also writing and filming a tutorial series on it. Since the built in documentation on that front is straight up error filled, omits critical information and also

Is there any IDE like Intellij for Unix shell scripting

On daily basis, I do write a lot of shell scripts for a different project.
I wanted to know, is there a way where I can write a lot of scripts project wise as we do create in IntelliJ/eclipse. As well as I could able to run those scripts from IDE only. I think this will create more clarity and my development speed will also increase.
Currently what i do, using FileZilla to connect to the server I open particular script as I set Sublime text as default file editor it opens into that only. I do make changes into the file and once I save it changes easily reflected into server using which to some extent solve my problem.
But does anyone knows!! is there any way/tool/software which could do all these steps/tasks as a whole.
That help to boost our productivity as IntelliJ and other IDEs are doing for many decades.
A better process is to have your scripts stored in git repository.
Clone the repository locally, edit your scripts using an editor/IDE of your choice. Test and once your changes are ready commit and push to the repository. Then update the repository copy on the server.

Creating on demand workflow directly in Production instance

I need a temporary workflow to update records in Production instance. I was thinking to just create one in production directly and run it on records and delete it. Whats the best way to do it, should I just create it in customization area (i.e. Default solution) and then delete it later or create a new solution, add this work flow to that solution and then delete that solution?
Or should I create it in Dev and then move the solution to Test/Production like we normally do?
As a best practice, create it in Dev using a new Hotfix solution - test it against some Dev records. Then export the solution (may be Managed one) & deploy in Test/UAT/Prod.
Once data fix is completed in Prod using our WF, delete the Managed solution (which will delete the WF too).
If you want - you can just deactivate the WF in Prod: Settings - Processes for future usage & to maintain environments in sync.
Never customize in the default solution - unless you're working on a managed solution (of which you have no control in Dev/Test), or are looking for a full list of components in an entity without adding them to your Solution (example - when writing a plugin, you need to know the field names of OOTB fields - I go to Default Solution to get these).
You didn't tell us in the message what your Workflow should be doing, and if it needs to be done in DEV or TEST.
What I would do is build the WF in DEV or test, re-create the situation that needs to be fixed in PROD, and test it in DEV/TEST. Once you know it will work, you can either push it over as a solution (or as a part of your existing solution), or, you can simply add it to your solution in PROD and then run it as required. If you need to delete it, great, delete it. If not, just de-activate it so people don't accidentally run it.

Force JBoss to reload JavaScript files

I am using JBoss Application Server 4.2.
I have noticed that when I update an .xhtml file, my local server will immediately reflect the change. However, if I update a .js file, it will not update until I restart the server. This is a huge hassle when I am working with .js files; any time I want to test a change, I need to restart the server.
Is there a way I can force JBoss to stop caching the file? Please note, solutions like this one don't work; the framework automatically includes the .js file, and I cannot change the <script src="..."> text manually.
This isn't a very elegant "solution," but I have three workarounds I've been using which mitigate the problem. I'll post them below for anyone else who has the same problem as I did:
Edit the .xhtml file on the server to add a dummy GET variable to the filename in the <script src="..."> tag. See here. In my case, because I'm using an external framework, this meant editing a XML file, which the server apparently doesn't cache.
Advantages: this will reload properly every time.
Disadvantages: I have to make sure I don't deploy the code to production with the dummy GET variable. Also, I lose any breakpoints in my debugger, which doesn't recognize that it's the same JS file.
Edit the file on the server, then make the exact same changes dynamically in Chrome debugger. See here.
Advantages: no need to worry about breakpoints or deploying bad code. No need even reload the page.
Disadvantages: the changes disappear as soon as I hit the reload button. Also, it's easy to make a mistake when synching the code.
Put the JavaScript code in the .xhtml file under its own <script> tag, then migrate it over to the .js file when ready to commit the changes.
Advantages: page reloads properly each time.
Disadvantages: migrating the code to the .js is a hassle, and it's easy to accidentally introduce bugs.
Neither of these solutions is perfect, but they work as decent patches. Of course, if anyone has a real solution to actually make the server stop caching the file, I'd still love to hear it.

Good ways to test changes on files without breaking website?

Every time I want to add new code to my site I have to modify the file outside of users view to debug it before updating the real file users see.
I usually create a copy of the file I want to change and test all changes on it but sometimes this files only appear included on another and I have to create two copies and sometimes it becomes even more complicated.
How is this normally done? Are there any tools to simplify the process, for example and enviroment to test my site on my PC so I don't have to upload files to the server each time I update something. Any info about beta testing new features will be thanked.
Most people have a 2nd server (potentially a virtual machine) configured exactly the same as their live (production) website. Where this 2nd server is located is completely up to you, but it should match your live site by using the same versions of software and same file structure.
I also like the idea of a staging server suggested by Sean. Again, your post doesn't say too much about your production web server and all of the features that you're using (are you running scripts on the server? PHP? some version of SQL?). But for a simple setup, you can run a copy of the Apache web server on your own PC, or something a little more lightweight like the XAMPP server.

Resources