You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DisCatSharp.Docs/articles/misc/hosting.md
+70-68Lines changed: 70 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,27 +26,30 @@ Depending on how complex your bot is, you may even consider purchasing a Raspber
26
26
27
27
If you don't have a PC or other gear sitting around, you may use your phone instead. Using [Termux](https://termux.dev/en/) and a program called [proot-distro](https://github.com/termux/proot-distro), you create a Debian virtual machine and configure .NET to run the bot.
28
28
29
-
> [!NOTE] > **Time required:** 30-45 minutes
29
+
> [!NOTE]
30
+
> **Time required:** 30-45 minutes
30
31
> **Difficulty:** Intermediate
31
32
> **Prerequisites:** Basic command line knowledge
32
33
33
-
> [!TIP] > **Performance:** This solution works well for small to medium bots. Resource-intensive bots may drain your battery or experience performance issues. For high-traffic production bots, consider traditional hosting.
34
+
> [!TIP]
35
+
> **Performance:** This solution works well for small to medium bots. Resource-intensive bots may drain your battery or experience performance issues. For high-traffic production bots, consider traditional hosting.
34
36
35
37
For anyone interested, the instructions are detailed below:
36
38
37
39
#### Requirements
38
40
39
-
-A phone with Android 7 or higher (5+ is possible but not recommended as it poses security issues).
40
-
-Termux installed from [F-Droid](https://f-droid.org/en/packages/com.termux/) (NOT from Google Play Store - the Play Store version is outdated).
41
-
-At least 2GB of free storage space.
42
-
-An internet connection.
43
-
-Basic understanding of bash and nano.
41
+
- A phone with Android 7 or higher (5+ is possible but not recommended as it poses security issues).
42
+
- Termux installed from [F-Droid](https://f-droid.org/en/packages/com.termux/) (NOT from Google Play Store - the Play Store version is outdated).
43
+
- At least 2GB of free storage space.
44
+
- An internet connection.
45
+
- Basic understanding of bash and nano.
44
46
45
-
> [!WARNING] > **Security:** Your bot token will be stored on your phone. Ensure your device is secured with a lock screen password.
47
+
> [!WARNING]
48
+
> **Security:** Your bot token will be stored on your phone. Ensure your device is secured with a lock screen password.
46
49
47
50
#### Setup
48
51
49
-
-Initialize Termux:
52
+
- Initialize Termux:
50
53
51
54
```sh
52
55
pkg update && pkg upgrade -y
@@ -55,7 +58,7 @@ pkg update && pkg upgrade -y
55
58
> [!TIP]
56
59
> It might ask you for input, just click enter and let the default option be executed.
57
60
58
-
-Install proot-distro package:
61
+
- Install proot-distro package:
59
62
60
63
```sh
61
64
pkg install proot-distro -y
@@ -69,7 +72,7 @@ proot-distro list
69
72
70
73
You should see available distributions including `debian`.
71
74
72
-
-Install a Debian Virtual Machine (VM):
75
+
- Install a Debian Virtual Machine (VM):
73
76
74
77
```sh
75
78
proot-distro install debian
@@ -78,31 +81,31 @@ proot-distro install debian
78
81
> [!NOTE]
79
82
> Installation time will depend on your internet speed.
-Add your configuration file, then build the project. To keep the bot online 24/7, check [here](#building-running).
159
+
- Add your configuration file, then build the project. To keep the bot online 24/7, check [here](#building-and-running).
156
160
157
161
##### Local Source Code
158
162
159
-
-If your source code is not hosted on the cloud, you can move the source code inside the VM by following the given steps:
163
+
- If your source code is not hosted on the cloud, you can move the source code inside the VM by following the given steps:
160
164
161
-
-Enable developer options on your phone ([find out how](https://developer.android.com/studio/debug/dev-options)), then enable USB debugging. You can find it by scrolling in "Developer Options".
165
+
- Enable developer options on your phone ([find out how](https://developer.android.com/studio/debug/dev-options)), then enable USB debugging. You can find it by scrolling in "Developer Options".
162
166
163
-
-Connect your phone to your computer using USB. Open a file manager and drag your project files into your phone's home directory.
167
+
- Connect your phone to your computer using USB. Open a file manager and drag your project files into your phone's home directory.
164
168
165
-
-To move the project files from your phone's storage into Termux, you'll need to set up storage permissions. Follow this [video guide](https://youtu.be/MMeM7szKt44), or use these steps:
169
+
- To move the project files from your phone's storage into Termux, you'll need to set up storage permissions. Follow this [video guide](https://youtu.be/MMeM7szKt44), or use these steps:
166
170
167
-
1. In Termux, run: `termux-setup-storage`
168
-
2. Grant storage permissions when prompted
169
-
3. Verify access: `ls ~/storage/shared/`
170
-
4. Your phone's files should now be accessible
171
+
1. In Termux, run: `termux-setup-storage`
172
+
2. Grant storage permissions when prompted
173
+
3. Verify access: `ls ~/storage/shared/`
174
+
4. Your phone's files should now be accessible
171
175
172
-
-Once you can see your files in `~/storage/shared/`, copy your project folder there using your phone's file manager.
176
+
- Once you can see your files in `~/storage/shared/`, copy your project folder there using your phone's file manager.
173
177
174
-
-Now, exit out of Debian. Inside Termux, create an environment variable that points to the VM's root directory. This allows you to access the VM's files from Termux. Add the following to your `.bashrc` file and update your session:
178
+
- Now, exit out of Debian. Inside Termux, create an environment variable that points to the VM's root directory. This allows you to access the VM's files from Termux. Add the following to your `.bashrc` file and update your session:
-Now, move the source code from your phone to the VM. The files should be in `~/storage/shared/`. Replace `projectname` with your actual project folder name:
186
+
- Now, move the source code from your phone to the VM. The files should be in `~/storage/shared/`. Replace `projectname` with your actual project folder name:
-Log back into Debian and verify the files are there:
192
+
- Log back into Debian and verify the files are there:
189
193
190
194
```sh
191
195
proot-distro login debian
192
196
ls
193
197
```
194
198
195
-
-Add your configuration file, then build the project.
199
+
- Add your configuration file, then build the project.
196
200
197
-
#### Building and Running {#building-running}
201
+
#### Building and Running
198
202
199
203
> [!WARNING]
200
204
> If you have folders such as `bin/` and `obj/` from your prior builds, delete those by running `rm -rf bin/ obj/`. You might run into issues otherwise.
201
205
202
-
-Build your project:
206
+
- Build your project:
203
207
204
208
```sh
205
209
dotnet build
206
210
```
207
211
208
-
-Run your bot:
212
+
- Run your bot:
209
213
210
214
```sh
211
215
dotnet run
@@ -252,7 +256,6 @@ cat ~/.bashrc | grep DOTNET
252
256
```
253
257
254
258
Ensure these lines exist:
255
-
256
259
```sh
257
260
export DOTNET_GCHeapHardLimit=1C0000000
258
261
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
@@ -264,7 +267,7 @@ If missing, add them, save, and run `source ~/.bashrc`.
264
267
265
268
**Problem: Bot stops when I close Termux**
266
269
267
-
Solution: You need to use `screen` to keep the bot running in the background. See the [keeping bot running section](#building-running).
270
+
Solution: You need to use `screen` to keep the bot running in the background. See the [keeping bot running section](#building-and-running).
268
271
269
272
---
270
273
@@ -278,7 +281,6 @@ ls ~/
278
281
```
279
282
280
283
If not there, check your source location:
281
-
282
284
```sh
283
285
exit# Exit Debian back to Termux
284
286
ls ~/storage/shared/
@@ -326,30 +328,30 @@ environment, particularly the shell (command line), and concepts such as SSH.
326
328
327
329
There are several well-known, trusted, and cheap providers:
328
330
329
-
-[Host Pls](https://host-pls.com/) - A hosting solution made by Discord bot developers. Based in America, starting from $2.49/mo.
330
-
-[Vultr](https://www.vultr.com/products/cloud-compute/) - Based in the US with datacenters in many regions, including APAC. Starting at $2.50/mo.
331
-
-[DigitalOcean](https://www.digitalocean.com/products/droplets/) - The gold standard, US based. Locations available world wide. Starting from $5.00/mo.
332
-
-[Linode](https://www.linode.com/products/shared/) - US based host with many datacenters around the world. Starting at $5.00/mo.
333
-
-[OVH](https://www.ovhcloud.com/en/vps/) - Very popular VPS host. Based in Canadian with French locations available. Starting from $6.00/mo.
334
-
-[Contabo](https://contabo.com/?show=vps) - Based in Germany; extremely good value for the price. Starting from 4.99€/mo.
331
+
-[Host Pls](https://host-pls.com/) - A hosting solution made by Discord bot developers. Based in America, starting from $2.49/mo.
332
+
-[Vultr](https://www.vultr.com/products/cloud-compute/) - Based in the US with datacenters in many regions, including APAC. Starting at $2.50/mo.
333
+
-[DigitalOcean](https://www.digitalocean.com/products/droplets/) - The gold standard, US based. Locations available world wide. Starting from $5.00/mo.
334
+
-[Linode](https://www.linode.com/products/shared/) - US based host with many datacenters around the world. Starting at $5.00/mo.
335
+
-[OVH](https://www.ovhcloud.com/en/vps/) - Very popular VPS host. Based in Canadian with French locations available. Starting from $6.00/mo.
336
+
-[Contabo](https://contabo.com/?show=vps) - Based in Germany; extremely good value for the price. Starting from 4.99€/mo.
335
337
336
338
Things to keep in mind when looking for a VPS host:
337
339
338
-
-The majority of cheap VPS hosts will be running some variant of Linux, and not Windows.
339
-
-The primary Discord API server is located in East US.
340
-
- If latency matters for you application, choose a host that is closer to this location.
340
+
- The majority of cheap VPS hosts will be running some variant of Linux, and not Windows.
341
+
- The primary Discord API server is located in East US.
342
+
- If latency matters for you application, choose a host that is closer to this location.
341
343
342
344
In addition to these, there are several hosting providers that offer free trials or in-service credit:
and Docker images on a Windows base or Linux base machine.
365
+
-[**AWS Fargate**](https://aws.amazon.com/fargate/"AWS Fargate"): Allows for hosting Docker images within Amazon Web Services
366
+
-[**Jelastic**](https://jelastic.com/docker/"Jelastic"): Allows for hosting Docker images.
365
367
366
368
# Making your publishing life easier
367
369
368
370
Now that we have covered where you can possibly host your application, now lets cover how to make your life easier publishing it. Many different
369
371
source control solutions out there are free and also offer some type of CI/CD integration (paid and free). Below are some of the
370
372
solutions that we recommend:
371
373
372
-
-[**Azure Devops**](https://azure.microsoft.com/en-us/services/devops/?nav=min"Azure Devops"): Allows for GIT source control hosting along with integrated CI/CD
373
-
pipelines to auto compile and publish your applications. You can also use their CI/CD service if your code is hosted in a different source control environment like Github.
374
-
-[**Github**](https://github.com/"GitHub") Allows for GIT source control hosting. From here you can leverage many different CI/CD options to compile and publish your
375
-
applications.
376
-
-[**Bitbucket**](https://bitbucket.org/"Bitbucket"): Allows for GIT source control hosting along with integrated CI/CD pipelines to auto compile and publish your applications.
374
+
-[**Azure Devops**](https://azure.microsoft.com/en-us/services/devops/?nav=min"Azure Devops"): Allows for GIT source control hosting along with integrated CI/CD
375
+
pipelines to auto compile and publish your applications. You can also use their CI/CD service if your code is hosted in a different source control environment like Github.
376
+
-[**Github**](https://github.com/"GitHub") Allows for GIT source control hosting. From here you can leverage many different CI/CD options to compile and publish your
377
+
applications.
378
+
-[**Bitbucket**](https://bitbucket.org/"Bitbucket"): Allows for GIT source control hosting along with integrated CI/CD pipelines to auto compile and publish your applications.
0 commit comments