Sign inSign up

michaelace/samp-server

By michaelace

•Updated almost 2 years ago

Deploy and configure your SAMP server easily

Image
Developer tools
0

206

michaelace/samp-server repository overview

⁠samp-server

This is a simple Docker image for running a SA-MP server. You can find the Git repository for this image here: https://github.com/MichaelAceAnderson/samp-docker⁠

⁠Usage

By default, the server loads an empty gamemode with no filterscripts. You can change them either by mounting a volume to the /server directory or by creating a new image that inherits from this one and adds the necessary files.
⚠️ NOTE: The log file being mapped to the output, setting a volume on the log file might prevent it from being displayed correctly in your terminal

To run your own server, you can create a new Dockerfile that inherits from this one and adds the necessary files. For example:

FROM michaelace/samp-server:0.3.7-R2-1

# Copy from local files to inside the container
COPY server/filterscripts ./filterscripts
COPY server/gamemodes ./gamemodes
COPY server/npcmodes ./npcmodes
COPY server/scriptfiles ./scriptfiles
COPY server/server.cfg .

# Expose the port with the UDP protocol
EXPOSE 7777/udp
⁠Changing the entrypoint

The current entrypoint is located at /entrypoint.sh. By default, it only starts the server with ./samp03svr, but it allows executing a custom command if provided as an argument. You can achieve this command by adding CMD to your Dockerfile:

FROM michaelace/samp-server:0.3.7-R2-1

# Copy from local files to inside the container
COPY server/filterscripts ./filterscripts
COPY server/gamemodes ./gamemodes
COPY server/npcmodes ./npcmodes
COPY server/scriptfiles ./scriptfiles
COPY server/server.cfg .

# Copy custom script
COPY custom-script.sh .

# Make the script executable
RUN chmod +x custom-script.sh

# Change the starting command
CMD ["./custom-script.sh"]

Then, you can build and run the new image:
⚠️ NOTE: If you are running the image under a WSL environment, UDP ports can't be forwarded to the host machine. You will need to use the IP address of the WSL machine to connect to the server, which can be found by running ip addr show eth0 in the WSL terminal.

docker build -t my-samp-server .
# ⚠️ It is mandatory to open the UDP port for the server to work properly
# ⚠️ The SAMP_RCON_PASSWORD environment variable has to be different from the default value (changeme) for security reasons
# The server will not run without SAMP_RCON_PASSWORD being set
# Remember to escape special characters in the password (e.g., $ -> \$)
docker run -p 7777:7777/udp -e SAMP_RCON_PASSWORD="n3Wpãs\$w0rD*_''" my-samp-server
⁠Environment variables

Every server.cfg variables can be replaced by the environment variables values as long as they are named properly in uppercase with the SAMP_ prefix. Example: rcon_password -> SAMP_RCON_PASSWORD="newpassword", gamemode0 -> SAMP_GAMEMODE0="script1 otherscript2"

Here is the table for all known variables until SAMP 0.3.DL:

KeyENV_VARTypeRead-onlyRuleDefault
echoSAMP_ECHOstringYesNoExecuting Server Config...
rcon_passwordSAMP_RCON_PASSWORDstringNoNochangeme
rconSAMP_RCONboolNoNo1
gamemode0SAMP_GAMEMODE0stringNoNograndlarc1
filterscriptsSAMP_FILTERSCRIPTSstringYesNo
pluginsSAMP_PLUGINSstringYesNo
announceSAMP_ANNOUNCEboolNoNo1
querySAMP_QUERYboolNoNo1
hostnameSAMP_HOSTNAMEstringNoNoSA-MP Server
languageSAMP_LANGUAGEstringNoNo
mapnameSAMP_MAPNAMEstringNoYesSan Andreas
gamemodetextSAMP_GAMEMODETEXTstringNoNoUnknown
weburlSAMP_WEBURLstringNoYes
versionSAMP_VERSIONstringYesYes
maxplayersSAMP_MAXPLAYERSintYesNo50
sleepSAMP_SLEEPintNoNo5
lanmodeSAMP_LANMODEboolNoNo0
bindSAMP_BINDstringYesNo
portSAMP_PORTintYesNo8192/7777
conncookiesSAMP_CONNCOOKIESintNoNo1
cookieloggingSAMP_COOKIELOGGINGintNoNo0
connseedtimeSAMP_CONNSEEDTIMEintNoNo300000
minconnectiontimeSAMP_MINCONNECTIONTIMEintNoNo0
messageslimitSAMP_MESSAGESLIMITintNoNo500
messageholelimitSAMP_MESSAGEHOLELIMITintNoNo3000
ackslimitSAMP_ACKSLIMITintNoNo3000
playertimeoutSAMP_PLAYERTIMEOUTintNoNo10000
mtuSAMP_MTUintYesNo576
outputSAMP_OUTPUTboolNoNo0
timestampSAMP_TIMESTAMPboolNoNo1
logtimeformatSAMP_LOGTIMEFORMATstringYesNo[%H:%M:%S]
logqueriesSAMP_LOGQUERIESboolNoNo0
chatloggingSAMP_CHATLOGGINGintNoNo1
db_loggingSAMP_DB_LOGGINGintNoNo0
db_log_queriesSAMP_DB_LOG_QUERIESintNoNo0
onfoot_rateSAMP_ONFOOT_RATEintYesNo40
incar_rateSAMP_INCAR_RATEintYesNo40
weapon_rateSAMP_WEAPON_RATEintYesNo40
stream_distanceSAMP_STREAM_DISTANCEfloatNoNo300.0
stream_rateSAMP_STREAM_RATEintNoNo1000
maxnpcSAMP_MAXNPCintNoNo0
myriadSAMP_MYRIADboolNoNo0
nosignSAMP_NOSIGNstringYesNo

Tag summary

Content type

Image

Digest

sha256:52b519954…

Size

64.4 MB

Last updated

almost 2 years ago

docker pull michaelace/samp-server:0.3.DL-R1