Skip to content

Parallel-Paradox/rust_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Server

This project is a little demo that builds a game server with rust, using axum as web framework.

Project Document >>

Dependency

See more in Cargo.toml

Build

Database service

Start database service. If you have started before, just ignore.

# on macOS
brew services start [email protected]
brew services start redis

MongoDB will listen on 127.0.0.1:27017 by default.
Redis will listen on 127.0.0.1:6379 by default.
If you change the ports that these services listen on, remember to change the configuration in constant.rs.

If you want to close service, run:

# on macOS
brew services stop [email protected]
brew services stop redis
  • brew services info ${SERVICE_NAME} : check the status of the given service.
  • redis-cli : Open a redis session.
  • mongosh : Open a mongodb session.

Set the authorization information MONGO_CREDENTIAL_${SUFFIX} in /constant/secret.rs.
Go to mongodb with mongosh and create an administrator in admin database.

use admin
db.createUser({
    user: '<USER-NAME>',
    pwd: '<PASSWORD>',
    roles: [{role:'userAdminAnyDatabase', db: 'admin'}]
})

To enable authorization for mongodb, set /etc/mongod.conf. If there's no such file, create one.

security:
  authorization: "enabled"

Set the connect uri in /job/create_word_list.js, do load(${Path_to_create_word_list.js}) in mongosh, the word list should be inserted into db automatically.

Debug build

cargo run

Release build

cargo run --release

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published