Comments (3)
Here's how you can deploy your get_server or any Dart server-side app on Ubuntu VPS:
Create, Compile and Run Your Project On The Local Machine
- Install the Dart SDK on your local machine by following the official docs here: https://dart.dev/get-dart
- Create your project:
dart create your_project_name
- Compile your project in native binary using:
dart compile exe bin/your_project_name.dart
and you should get a file with .exe extension (your_project_name.exe) - Confirm that your app is running by:
./your_project_name.exe
and visiting http://localhost:8080
If everything is ok, then move on to the next part.
On The VPS
- Upload the exe file to your VPS. Let's say on
/home/user/projects
directory. - Optionally you can confirm that it's also working on your server by running
./your_project_name.exe
and visiting http://your_vps_ip:8080*
Configure systemd Service
- Create a systemd service by
sudo nano /etc/systemd/system/your_project_name.service
and pasting the following:
[Unit]
Description=My Dart Server App
[Service]
User=user
WorkingDirectory=/home/user/projects
ExecStart=/home/user/projects/your_project_name.exe
Restart=always
[Install]
WantedBy=multi-user.target
- Enable the service:
sudo systemctl enable your_project_name
- Restart systemd daemon:
sudo systemctl daemon-reload
- Start the service:
sudo service your_project_name start
- Check if everything is ok and your service is running properly:
sudo service your_project_name status
Configure nginx Server Block and Proxy Pass
- Create a nginx server block by
sudo nano /etc/nginx/sites-available/your_project_name.conf
and pasting the following:
server {
listen 80;
server_name your_domain_name;
root /home/user/projects;
location / {
try_files $uri @proxy;
}
location @proxy {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
}
}
- Enable the server block:
sudo ln -s /etc/nginx/sites-available/your_project_name.conf /etc/nginx/sites-enabled/your_project_name.conf
- Test your nginx configuration:
sudo nginx -t
- Restart nginx:
sudo service nginx reload
That's it! Now you can visit your_domain_name
to see your shiny new get_server dart app in full effect on the web.
Additionally, you can secure your app using Let's Encrypt SSL using certbot: sudo certbot -d your_domain
Here's the live example: http://getxserver.smj.xyz/
And here's the example repo: https://github.com/smjxpro/get_server_boot
- You may need to change the file permission(
sudo chmod 777 your_project_name.exe
) and disable firewall or open port 8080.
from get_server.
Here's how you can deploy your get_server or any Dart server-side app on Ubuntu VPS:
Create, Compile and Run Your Project On The Local Machine
- Install the Dart SDK on your local machine by following the official docs here: https://dart.dev/get-dart
- Create your project:
dart create your_project_name
- Compile your project in native binary using:
dart compile exe bin/your_project_name.dart
and you should get a file with .exe extension (your_project_name.exe)- Confirm that your app is running by:
./your_project_name.exe
and visiting http://localhost:8080If everything is ok, then move on to the next part.
On The VPS
- Upload the exe file to your VPS. Let's say on
/home/user/projects
directory.- Optionally you can confirm that it's also working on your server by running
./your_project_name.exe
and visiting http://your_vps_ip:8080*Configure systemd Service
- Create a systemd service by
sudo nano /etc/systemd/system/your_project_name.service
and pasting the following:[Unit] Description=My Dart Server App [Service] User=user WorkingDirectory=/home/user/projects ExecStart=/home/user/projects/your_project_name.exe Restart=always [Install] WantedBy=multi-user.target
- Enable the service:
sudo systemctl enable your_project_name
- Restart systemd daemon:
sudo systemctl daemon-reload
- Start the service:
sudo service your_project_name start
- Check if everything is ok and your service is running properly:
sudo service your_project_name status
Configure nginx Server Block and Proxy Pass
- Create a nginx server block by
sudo nano /etc/nginx/sites-available/your_project_name.conf
and pasting the following:server { listen 80; server_name your_domain_name; root /home/user/projects; location / { try_files $uri @proxy; } location @proxy { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; } }
- Enable the server block:
sudo ln -s /etc/nginx/sites-available/your_project_name.conf /etc/nginx/sites-enabled/your_project_name.conf
- Test your nginx configuration:
sudo nginx -t
- Restart nginx:
sudo service nginx reload
That's it! Now you can visit
your_domain_name
to see your shiny new get_server dart app in full effect on the web.
Additionally, you can secure your app using Let's Encrypt SSL using certbot:sudo certbot -d your_domain
Here's the live example: http://getxserver.smj.xyz/
And here's the example repo: https://github.com/smjxpro/get_server_boot
- You may need to change the file permission(
sudo chmod 777 your_project_name.exe
) and disable firewall or open port 8080.
Nice tutorial <3
from get_server.
very nice tuto!
from get_server.
Related Issues (20)
- how to save image using multipart HOT 3
- how to upload File(image,pdf, etc...) to server HOT 3
- Unhandled exception: MimeMultipartException: Bad multipart ending
- A big thanks for your valuable support.... 👍👍👍 Below i list 3 problem when I integration/testing getxserver HOT 1
- File Upload some time get unreadable image HOT 3
- How to run the server app in the background of a flutter app? HOT 1
- How to config CER and how redirect http to https ? HOT 1
- Custom Response - Empty list as json HOT 2
- CRUD example required HOT 1
- context_request support formdata
- How to show the post request comming from the user ?
- Get payload data from post request HOT 2
- cant run compiled js file
- Flutter: webview_flutter_plus error: Server Error: Unsupported operation: ServerSocket.bind HOT 1
- ``` Apache License Copyright Request ``` Wish to modify some of source code for my own project HOT 2
- This project is truly impressive.You are absolutely insane. HOT 2
- Is this project abandoned?
- SocketException: Connection reset by peer (OS Error: Connection reset by peer, errno = 104), address = 0.0.0.0 HOT 1
- Refactoring this project HOT 2
- Flutter web application Cross-Origin Resource Sharing (CORS) issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from get_server.