nitro-docker/README.md

252 lines
11 KiB
Markdown
Raw Normal View History

2023-03-13 18:36:30 +01:00
# Nitro Docker installation
Nitro docker is a quick-to-setup docker environment for the [nitro client](https://github.com/billsonnn/nitro-react) with [Arcturus Community Emulator](https://git.krews.org/morningstar/Arcturus-Community). It can be run on Windows, Linux or OSX just with a few commands. It is inspired by [Holo5/nitro-docker](https://github.com/Holo5/nitro-docker).
The default configuration can run on localhost.
**This Repository uses `ms4/dev` branch!**
2023-03-21 00:13:46 +01:00
**This Repository uses a [forked version](https://github.com/Gurkengewuerz/nitro) of Nitro with bug-fixes and more features!**
2023-03-13 18:36:30 +01:00
## Requirements
- Install docker desktop (and for windows, enable WSL support) [from here](https://www.docker.com/get-started/).
2023-10-25 10:49:21 +02:00
- Node.js LTS or higher (For the habbo-downloader)
2023-03-13 18:36:30 +01:00
- Clone this repository
2023-10-29 19:01:01 +01:00
## Notes
This setup installs a complete local setup. Connecting externally requires editing the configurations. Serach for the following ports and edit them. Down below is a recommended domain setup when using reverse proxies like traefik.
| Server | Local Setup | Recommended Domain Setup |
|-----------------------|-----------------------|--------------------------|
| MorningStar WebSocket | ws://127.0.0.1:2096 | game.example.com |
| Assets Server | http://127.0.0.1:8080 | assets.example.com |
| CMS | http://127.0.0.1:8081 | example.com |
| Nitro Client | http://127.0.0.1:3080 | game.example.com |
2023-10-30 00:13:36 +01:00
```sql
UPDATE emulator_settings SET `value`='*.example.com' WHERE `key`='websockets.whitelist';
2023-10-30 00:13:36 +01:00
```
2023-03-13 18:36:30 +01:00
## Build
0. copy necessary files to work locally
The following command searches for all files starting with `example-`, copies the file and remove the `example-` prefix. If you don't have access to the find command, you can do it manually.
```bash
find . -type f -name 'example-*' -exec sh -c 'cp -rf "$0" "${0/example-/}"' {} \;
```
2023-03-22 20:31:24 +01:00
1. Download the default assets
2023-03-13 18:36:30 +01:00
2023-03-22 20:31:24 +01:00
> The `&& \` is used to combine multiple commands into a single line in a Unix-like command shell. By using && \, the two commands are executed sequentially and only if the first command succeeds. If the first command fails, the second command will not be executed, saving you from potential errors.
2023-03-13 18:36:30 +01:00
```bash
2023-03-22 20:31:24 +01:00
git clone https://github.com/Gurkengewuerz/nitro-docker.git && \
cd nitro-docker/ && \
git clone https://git.krews.org/morningstar/arcturus-morningstar-default-swf-pack.git assets/swf/ && \
git clone https://github.com/krewsarchive/default-assets.git assets/assets/ && \
wget https://github.com/billsonnn/nitro-react/files/10334858/room.nitro.zip && \
unzip -o room.nitro.zip -d assets/assets/bundled/generic && \
2023-03-13 18:36:30 +01:00
docker compose up db -d
```
2023-03-22 20:31:24 +01:00
**The database port is exposed to `3010` by default**
2. Configure the `.env` to your needs
3. Download SQL updates:
https://git.krews.org/morningstar/Arcturus-Community/-/archive/ms4/dev/Arcturus-Community-ms4-dev.zip?path=sqlupdates
4. Manually initialize database with HeidiSQL.
- Download `HeidiSQL` from: https://www.heidisql.com/download.php
- Open `HeidiSQL.exe` and connect to the nitro-docker-db container
```text
# **Default login credentials using HeidySQL:**
# Network type: MariaDB or MySQL (TCP/IP)
# Library: libmysql.dll
2023-03-22 20:31:24 +01:00
# Hostname /IP: YOURSERVERIPHERE!!
# User: arcturus_user
# Password: arcturus_pw
# Port: 3310
# Databases: Separated by semicolon
```
2023-03-13 18:36:30 +01:00
2023-03-22 20:31:24 +01:00
- Select **arcturus**
2023-03-13 18:36:30 +01:00
2023-03-22 20:31:24 +01:00
- Go to **File** --> **Run SQL file...** and open **arcturus_3.0.0-stable_base_database--compact.sql** Located at: nitro-docker/arcturus/arcturus_3.0.0-stable_base_database--compact.sql
- For the popup: Really auto-detect file encoding? click on **Yes**
- Go to **File** --> **Run SQL file...** and open **3_0_0 to 3_5_0.sql** Located at: \Arcturus-Community-ms4-dev-sqlupdates\sqlupdates
- Go to **File** --> **Run SQL file...** and open **3_5_0 to 4_0_0.sql**
- Go to **File** --> **Run SQL file...** and open **4_0_0_pets_EN.sql**
- Go to **File** --> **Run SQL file...** and open **4_0_0_permissions.sql**
2023-10-25 10:49:21 +02:00
If you set-up a clean database you also wan't to create new permission groups. This is the new permission structure by Arcturus.
- Go to **File** --> **Run SQL file...** and open **perms_groups.sql** Located at: ./arcturus
2023-03-22 20:31:24 +01:00
5. Update emulator settings with HeidiSQL
- Select `Query` then copy paste the follwing queries:
2023-03-13 18:36:30 +01:00
```sql
2023-10-25 10:49:21 +02:00
-- requirements for the camera mod
2023-03-13 18:36:30 +01:00
UPDATE emulator_settings SET `value`='http://127.0.0.1:8080/usercontent/camera/' WHERE `key`='camera.url';
UPDATE emulator_settings SET `value`='/app/assets/usercontent/camera/' WHERE `key`='imager.location.output.camera';
2023-03-14 20:02:59 +01:00
UPDATE emulator_settings SET `value`='/app/assets/usercontent/camera/thumbnail/' WHERE `key`='imager.location.output.thumbnail';
2023-03-22 20:31:24 +01:00
2023-10-25 10:49:21 +02:00
-- because we have no image.php proxy which is set by default to proxy youtube images we do a microservice aproach by proxy data through a go service
UPDATE emulator_settings SET `value`='http://127.0.0.1:8080/api/imageproxy/0x0/http://img.youtube.com/vi/%video%/default.jpg' WHERE `key`='imager.url.youtube';
2023-10-25 10:49:21 +02:00
-- This will Disable console mode for Arcturus because we are using docker.
2023-03-13 18:36:30 +01:00
UPDATE emulator_settings SET `value`='0' WHERE `key`='console.mode';
2023-10-25 10:49:21 +02:00
-- badges are dynamically generated by Nitro. This setting is only useful if a) you have group_badge.nitro and swf/c_images/Badgeparts/ in sync b) you wan't to hide the the error message
UPDATE emulator_settings SET `value`='/app/assets/usercontent/badgeparts/generated/' WHERE `key`='imager.location.output.badges';
UPDATE emulator_settings SET `value`='/app/assets/swf/c_images/Badgeparts' WHERE `key`='imager.location.badgeparts';
2023-03-13 18:36:30 +01:00
```
2023-03-22 20:31:24 +01:00
- Press `F9` on your keyboard to run the queries
2023-03-13 18:36:30 +01:00
2023-03-22 20:31:24 +01:00
6. Start Asset Server, Build assets locally, Arcturus Community Emulator and Nitro
2023-03-13 18:36:30 +01:00
```bash
2023-03-22 20:31:24 +01:00
docker compose up assets -d && \
docker compose up assets-build --build && \
2023-10-26 01:14:25 +02:00
docker compose up imgproxy --build -d && \
docker compose up arcturus --build -d
2023-03-13 18:36:30 +01:00
```
2023-03-22 20:31:24 +01:00
7. Update the: `nitro/renderer-config.json` and `nitro/ui-config.json` values to your setup. If the deployment is buggy or throws any errors check the json files for updates. then Build and Start Nitro
2023-03-13 18:36:30 +01:00
```bash
docker compose up nitro --build -d
2023-03-13 18:36:30 +01:00
```
2023-03-22 20:31:24 +01:00
> habbo-downloader requires **Node.js 15.0** or higher you can install the newest version with the following command:
2023-03-13 18:36:30 +01:00
```bash
2023-03-22 20:31:24 +01:00
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && \
nvm install node
2023-03-13 18:36:30 +01:00
```
2023-03-22 20:31:24 +01:00
> Next setup reverse proxies for your nginx or traefik server. You should disable proxy side caching.
## Update to latest production
8. Update a few assets since we want the most up to date assets as possible. You can remove habbo-downloader lines if needed or you can just download everything.
```text
# Replace `--domain de with` your own country code
# For example if you want Dutch then do `--domain nl`
# **Here is a list of supported country codes:**
# Portugese `--domain com.br`
# Turkish `--domain com.tr`
# English `--domain com`
# German `--domain de`
# Spanish `--domain es`
# Finnish `--domain fi`
# French `--domain fr`
# Italian `--domain it`
# Dutch `--domain nl`
2023-03-13 18:36:30 +01:00
```
```bash
2023-03-22 20:31:24 +01:00
apt install npm -y && \
npm i -g habbo-downloader && \
rm -rf assets/swf/gordon/PRODUCTION && \
habbo-downloader --output ./assets/swf --domain com --command badgeparts && \
habbo-downloader --output ./assets/swf --domain com --command badges && \
habbo-downloader --output ./assets/swf --domain com --command clothes && \
habbo-downloader --output ./assets/swf --domain com --command effects && \
habbo-downloader --output ./assets/swf --domain com --command furnitures && \
habbo-downloader --output ./assets/swf --domain com --command gamedata && \
habbo-downloader --output ./assets/swf --domain com --command gordon && \
habbo-downloader --output ./assets/swf --domain com --command hotelview && \
habbo-downloader --output ./assets/swf --domain com --command icons && \
habbo-downloader --output ./assets/swf --domain com --command mp3 && \
habbo-downloader --output ./assets/swf --domain com --command pets && \
habbo-downloader --output ./assets/swf --domain com --command promo && \
cp -n assets/swf/dcr/hof_furni/icons/* assets/swf/dcr/hof_furni && \
mv assets/swf/gordon/PRODUCTION* assets/swf/gordon/PRODUCTION && \
docker compose up assets-build --build
2023-03-13 18:36:30 +01:00
```
## Update Languages
```bash
2023-03-22 20:31:24 +01:00
habbo-downloader --output ./assets/translation --domain com --command gamedata && \
cd ./assets/translation && \
cp -rf gamedata/external*.txt ../swf/gamedata/ && \
cd ../.. && \
docker compose up assets-build --build && \
cd ./assets/translation && \
python FurnitureDataTranslator.py && \
python SQLGenerator.py && \
python external_text.py --domain com
2023-03-22 20:31:24 +01:00
```
* run SQL file
2023-10-25 10:49:21 +02:00
* maybe run other `./assets/translation/*.sql` files which are fixes for Arcturus catalog like to display Song names/preview, fixing crackables or known wrong item bases.
2023-03-22 20:31:24 +01:00
```bash
docker compose restart arcturus
2023-03-13 18:36:30 +01:00
```
2023-10-26 01:14:25 +02:00
## AtomCMS
2023-10-29 19:01:01 +01:00
1. change [`.cms.env`](/.cms.env) to your needs
2023-10-26 01:14:25 +02:00
2. Check your permissions table. Use [**perms_groups.sql**](/arcturus/perms_groups.sql) if unclear. AtomCMS is not using the new permission layout so we are legacy supporting it by "copy" the most important values.
4. Start the CMS
```bash
docker compose up cms --build -d
```
5. Generate a new secret APP_KEY
```bash
docker compose exec cms php artisan key:generate
```
6. Open the CMS in the browser by default [`127.0.0.1:8081`](http://127.0.0.1:8081/) and do the basic setup.
7. Update automcms settings with HeidiSQL
```sql
UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/api/imager/?figure=' WHERE `key` = 'avatar_imager';
UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/swf/c_images/album1584' WHERE `key` = 'badges_path';
UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/usercontent/badgeparts/generated' WHERE `key` = 'group_badge_path';
UPDATE website_settings SET `value` = 'http://127.0.0.1:8080/swf/dcr/hof_furni' WHERE `key` = 'furniture_icons_path';
UPDATE website_settings SET `value` = 'arcturus' WHERE `key` = 'rcon_ip';
UPDATE website_settings SET `value` = '3001' WHERE `key` = 'rcon_port';
-- check values - these values are for the perms_groups.sql
UPDATE website_settings SET `value` = '4' WHERE `key` = 'min_staff_rank';
UPDATE website_settings SET `value` = '5' WHERE `key` = 'min_maintenance_login_rank';
UPDATE website_settings SET `value` = '6' WHERE `key` = 'min_housekeeping_rank';
2023-10-26 01:14:25 +02:00
```
** Notice**: badgeparts generator must be set up in arcturus and all files must be synced with the badge_parts.nitro
2023-03-13 18:36:30 +01:00
## Create an archive/backup
### Export running containers
2023-03-13 18:36:30 +01:00
```bash
bash ./export_containers.sh
2023-03-13 18:36:30 +01:00
```
### Create manual database backup
```bash
docker compose exec backup backup-now
```
### Save all data
```bash
2023-10-26 02:43:30 +02:00
7z a -mx=9 nitro-$(date -d "today" +"%Y%m%d_%H%M").7z ./ '-x!db/data' '-x!.git/' '-x!logs/' '-x!cache/'
```