Hi, I want to know how to deploy google ai studio app without using Google cloud Run. Also how to Connect a database with my app. Hall you contributions and proposals are welcome. Thanks u
I’ve done this a few times now, deploying the apps to a server running Ubuntu 24.04 with NPM installed. It’s not that difficult, but it does require some trial and error. I do use the command “sudo su” first to execute my next commands as administrator.
- Start by downloading the source from AI Studio. This will give you a ZIP file to extract on your server. The content of the ZIP file goes to /var/www/{domain}/{AppName} where {domain} is the domain for where it will run and {AppName} is the name of your application.
- Open the SSH/Terminal to connect to your Linux server and go to this directory where the source is extracted.
- Run the command: “npm install” to activate NPM. This will download the required NPM packages and create a node_modules folder.
- Run the command: “npm build” in this folder. This will tell NPM to make a distribution folder for your source with a transpiled (compiled) version of your code. (Well, just a large JavaScript file and some more stuff.)
Now your app is up and running on your local server, but you still have to set up the server part for this. I use nginx on my server, so here are instructions on how to make it a real site:
- Use the command “cd /etc/nginx/sites-available/” to go to the nginx configuration and create a new config file. (E.g. {domain}.conf) You can do this by e.g. the command “nano example.com.conf”. (I like adding the extension .conf to my nginx files.)
- Put the following lines into that file:
server {
listen 80;
server_name {domain} www.{domain};
root /var/www/{domain}/{AppName}/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
- Use the command “ln -s /etc/nginx/sites-available/{domain} /etc/nginx/sites-enabled/” to enable the site you just created.
- Use the command “nginx -t” to test if the new configuration works.
- Use the command “systemctl restart nginx” to restart nginx so it knows about the changes.
- Open your browser and open {domain} to see if it works.
(You might also have to check your firewall settings and some other stuff.)
This is just what I do in a nutshell, and you might be working with a completely different setup. For example, it is possible to use npm to run the app as an application instead of just setting up a static page like I did. It’s just that I prefer it to be a static page as I build my own web services (In C# with .NET 8) for any backend logic. My Web App is thus calling my Web APIs to do whatever is needed, including any database-related stuff. Why? For me it’s mostly for security reasons. But also because I can reuse my API in other projects.
And yes, by using my own Web API, I also have to tell AI Studio to import my C# Swagger settings (a JSON file) and make a service module around it to call my API. This works quite well, actually.
To be clear, this is just how I deploy these apps. Others will use different methods and you just have to explore which option works best for you. If you don’t have your own server then things might be a bit trickier.
Thanks you very much. Is there web plateform I can deploy my app without using linux ? Don’t hesitate to share links, vidéos links and ressources with me. Thank you very much…
I have my own web server, so I’ve never looked into that. There are probably many providers that offer the hosting you want, but it all depends on your needs and budget. But I don’t know any.