How To Implement A Better Build Strategy for Next.js App - deployment

I am hosting a Next.js app on digitalocean and managing it as a process using pm2.
Everything is working well except when I am pushing changes to server. Both create react app and Next.js are unavailable at build time, nginx return a server error or not found error when building the apps. When using create react app I would build the files on my local computer and send them to the server using ssh which allowed for quicker updates. I can't see how the same is possible with Next.js.
My main problem is how I can still build the Next.js while still making the previous build available until the current build is complete.

make one bash script and insert condition
if name "a" folder is available then create "b"
elif if name "b" folder is available then create "a"
else create name "a" folder
if name "A" folder available then create name "b" folder and run all commands on name "b" folder like "npm i " npm run build " after complete of execution . then delete name "a" folder then run pm2 stop appname then go through name "b" folder and run pm2 start
thease all commands run through bash script

Related

Disable .vscode-server/data/user/history caching

i use nextjs in vscode and every time i build my app with
npm run build
the buildId and old build path are saved in .vscode-server/data/user/history I want to disable this because for some reason my nextjs app uses that old info sometimes and changes my new build on itself what results in a 404 error for the buildManifest.js file. This is because it uses the old folder name but the folder has a different name (generated with npm run build). I do this with SSH to my raspberry pi. Let me know! Thanks.

Copy issues using vscode

I downloaded a document “initializr”. I created a directory Git-Class on Desktop. I get into Git-Class and I’m trying to copy initializr from the Download directory to past it where I am in Git-Class using vscode on my Mac by running “ cp -r initializr /users/administrator/Downloads .” I keep getting the “No such file or directory and on the directory’s name and on the path’s name. However when I run the “ls” command in Git-Class it will show nothing and when I run the copy command again “ls” will show the “Downloads directory” instead of just “initializr” that I’m looking for and that’s in “Downloads”

Rundeck is not generating service.log

One of my colleague is trying to install rundeck on a windows 10 OS. We have both followed the documentation guide on Rundeck's website. I was able to run and install Rundeck as a service but my colleague is stuck on the part where we need to run start_rundeck.bat because his Rundeck is not generating service.log. He can access the Rundeck UI but the logs are still not generating. Anyone knows how to fix this issue? Thanks!
Your colleague just needs to follow the instructions carefully.
Let me clarify the first steps focused on redirecting the standard output to the service.log file, I recreated the Rundeck installation on my Windows virtual machine:
First, check the minimal requirements. Rundeck needs OpenJDK 11 as the main dependency to work. You can obtain it from here, this implementation also works.
Create a new directory where the Rundeck .war file must be saved, e.g: C:\rundeck.
Go to this page and download .war file on the directory created in the previous step.
Open a new PowerShell terminal and set the Rundeck base directory: set RDECK_BASE=C:\rundeck.
Launch Rundeck for the first time to generate all files: java -jar rundeck-3.4.6-20211110.war (inside the directory created in the second step), wait until the Grails application running at http://localhost:4440 message appear, then stop the instance with ctrl + c key combination.
With any text editor, create a new file at C:\rundeck\ path called start_rundeck.bat with the following content:
set CURDIR=%~dp0
call %CURDIR%etc\profile.bat
java %RDECK_CLI_OPTS% %RDECK_SSL_OPTS% -jar rundeck-3.4.6-20211110.war --skipinstall -d >> %CURDIR%\var\logs\service.log 2>&1
And save it.
Go to the PowerShell terminal and just run the start_rundeck.bat file with .\start_rundeck.bat.
Now check the C:\rundeck\var\logs\service.log file.
At this point, it's possible to continue with the next steps: Configure Rundeck as a service using the nssm.exe program.

Why is the gcloud sdk's deploy command looking at my home directory for files?

I'm attempting to deploy a python server to Google App Engine.
I'm trying to use the gcloud sdk to do so.
It appears the command I need to use is gcloud app deploy.
I get the following error:
me#mymachine:~/development/some-app/backend$ gcloud app deploy
ERROR: (gcloud.app.deploy) Error Response: [3] The directory [~/.config/google-chrome/Default/Cache] has too many files (greater than 1000).
I had to add ~/.config to my .gcloudignore to get past this error.
Why was it looking there at all?
The full repo of my project is public but I believe I've included the relevant portion.
I looked at your linked repo and there aren't any yaml files. As far as I know, a GAE project needs an app.yaml file because that file tells GAE what your runtime is so that GAE knows how to deploy/run your code. In fact, according to the gcloud app deploy documentation, if you don't specify any yaml files to be deployed, it will default to app.yaml in the current directory. If it can't find any in the current directory, it will try to build one.
Your repo also shows you have a Dockerfile. GAE documentation for custom runtimes says ...Custom runtimes let you build apps that run in an environment defined by a Dockerfile... In the app.yaml file for custom runtimes, you will have the following entry
runtime: custom
env: flex
Since you don't have an app.yaml file and you have a Docker file in which you are downloading and installing Chrome, it seems to me that gcloud app deploy is trying to infer your runtime and this has led to it executing some or all of the contents of the Dockerfile before it attempts to then push it to Production. This is what is making it take a peek at the config file on your local machine till you explicitly tell it to ignore it. To be clear, I'm not 100% sure of this, just trying to see if I can draw a logical conclusion.
My suggestion would be to create an app.yaml file and specify a custom runtime. Or just use the python runtime with flex

Ionic Starter App testing - www directory not dound

I am new to this platform and I am following the guidelines at the docs. I am trying to test the app using ionic serve CLI response is that there are 3 addresses....I choose localhost and an error comes up - ""www" directory not found. please make sure the working directory is ionic project"
I need help working around this.
I am working on windows 7.
This generally happens when you try to run your project into sub-directory which do not contains ionic project. Verify if you have 'www' folder inside your ionic project or you mistakenly went inside other sub-directory and trying to execute 'ionic serve' command.
After creating you project. The cmd screen will give you the directory of newly created project. Therefore in the CMD type this command:
cd yourprojectname
eg
cd myionicproject
after that command is completed enter command:
$ ionic serve