Commit e3ac568c authored by ham's avatar ham

Dockernize

parent 572e5ad9
Pipeline #66936 passed with stages
in 1 minute and 47 seconds
......@@ -321,3 +321,31 @@ It might be the case that the first time the visualization application is loaded
__NOTE__: if this solution does not work, it is possible that a software is blocking the WebSocket connection between the webapp and the SmartFox server.
## Docker
To run the server in docker container. Follow the steps:
1. cd into directory `./docker/`
2. Build the docker image using `build.sh`
3. Build the docker image for RMI server. Instructions can be found in the rmi server repo.
Start the server with:
```
docker-compose up
```
or, to run in the background:
```
docker-compose up -d
```
Then the smartfox admin panel can be accessed with username __sfsadmin__ and password __sfsadmin__ under:
> localhost:8080/admin
The visualization service can be accessed under:
> localhost:8080/visualization
There is one last thing to do before visualization service is available. Login to the admin panel, go to server -> webserver and activate the websocket service. Click sumbit button and restart button. After that, the visualization service is good to go.
Note there is a file `./docker/World.zone.xml`. It's a config file generated by smartfox after following the instruction in previous `Configuration` section. If you want to change any configuration, simply use the smartfox admin panel will do the work.
FROM timlien/docker-smartfox:latest
COPY sqlite-jdbc-3.23.1.jar SFS2X/lib/sqlite-jdbc-3.23.1.jar
COPY World.zone.xml SFS2X/zones/World.zone.xml
COPY visualization SFS2X/www/visualization
COPY AllInOne SFS2X/extensions/AllInOne
<zone>
<name>World</name>
<isCustomLogin>false</isCustomLogin>
<isForceLogout>true</isForceLogout>
<applyWordsFilterToUserName>true</applyWordsFilterToUserName>
<applyWordsFilterToRoomName>true</applyWordsFilterToRoomName>
<applyWordsFilterToPrivateMessages>true</applyWordsFilterToPrivateMessages>
<isFilterBuddyMessages>true</isFilterBuddyMessages>
<isEncrypted>false</isEncrypted>
<maxUsers>1000</maxUsers>
<maxUserVariablesAllowed>5</maxUserVariablesAllowed>
<maxRoomVariablesAllowed>5</maxRoomVariablesAllowed>
<minRoomNameChars>3</minRoomNameChars>
<maxRoomNameChars>10</maxRoomNameChars>
<maxRooms>500</maxRooms>
<maxRoomsCreatedPerUser>3</maxRoomsCreatedPerUser>
<userCountChangeUpdateInterval>1000</userCountChangeUpdateInterval>
<userReconnectionSeconds>0</userReconnectionSeconds>
<overrideMaxUserIdleTime>120</overrideMaxUserIdleTime>
<maxFailedLogins>4</maxFailedLogins>
<allowGuestUsers>true</allowGuestUsers>
<guestUserNamePrefix>Guest#</guestUserNamePrefix>
<publicRoomGroups>default</publicRoomGroups>
<defaultRoomGroups>default</defaultRoomGroups>
<defaultPlayerIdGeneratorClass></defaultPlayerIdGeneratorClass>
<allowInvitationsOnlyForBuddies>false</allowInvitationsOnlyForBuddies>
<maxUsersPerJoinInvitationRequest>5</maxUsersPerJoinInvitationRequest>
<geoLocationEnabled>false</geoLocationEnabled>
<wordsFilter active="false">
<useWarnings>false</useWarnings>
<warningsBeforeKick>3</warningsBeforeKick>
<kicksBeforeBan>2</kicksBeforeBan>
<banDuration>1440</banDuration>
<maxBadWordsPerMessage>0</maxBadWordsPerMessage>
<kicksBeforeBanMinutes>3</kicksBeforeBanMinutes>
<secondsBeforeBanOrKick>5</secondsBeforeBanOrKick>
<warningMessage>Stop swearing or you will be banned</warningMessage>
<kickMessage>Swearing not allowed: you are being kicked</kickMessage>
<banMessage>Too much swearing: you are banned</banMessage>
<wordsFile>config/wordsFile.txt</wordsFile>
<filterMode>BLACKLIST</filterMode>
<banMode>NAME</banMode>
<hideBadWordWithCharacter>*</hideBadWordWithCharacter>
</wordsFilter>
<floodFilter active="false">
<banDurationMinutes>1440</banDurationMinutes>
<maxFloodingAttempts>5</maxFloodingAttempts>
<secondsBeforeBan>5</secondsBeforeBan>
<banMode>NAME</banMode>
<logFloodingAttempts>true</logFloodingAttempts>
<banMessage>Too much flooding, you are banned</banMessage>
</floodFilter>
<rooms/>
<disabledSystemEvents/>
<privilegeManager active="false">
<profiles class="java.util.Arrays$ArrayList">
<a class="profile-array">
<profile id="0">
<name>Guest</name>
<deniedRequests class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>CreateRoom</string>
<string>PrivateMessage</string>
<string>SetRoomVariables</string>
<string>SetUserVariables</string>
<string>ChangeRoomName</string>
<string>ChangeRoomPassword</string>
<string>ChangeRoomCapacity</string>
<string>InitBuddyList</string>
<string>AddBuddy</string>
<string>BlockBuddy</string>
<string>RemoveBuddy</string>
<string>SetBuddyVariables</string>
<string>GoOnline</string>
<string>BuddyMessage</string>
<string>ModeratorMessage</string>
<string>AdminMessage</string>
<string>KickUser</string>
<string>BanUser</string>
</a>
</deniedRequests>
<permissionFlags/>
</profile>
<profile id="1">
<name>Standard</name>
<deniedRequests class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>ModeratorMessage</string>
<string>AdminMessage</string>
<string>KickUser</string>
<string>BanUser</string>
</a>
</deniedRequests>
<permissionFlags class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>ExtensionCalls</string>
</a>
</permissionFlags>
</profile>
<profile id="2">
<name>Moderator</name>
<deniedRequests class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>AdminMessage</string>
</a>
</deniedRequests>
<permissionFlags class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>ExtensionCalls</string>
<string>SuperUser</string>
</a>
</permissionFlags>
</profile>
<profile id="3">
<name>Administrator</name>
<deniedRequests/>
<permissionFlags class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>ExtensionCalls</string>
<string>SuperUser</string>
</a>
</permissionFlags>
</profile>
</a>
</profiles>
</privilegeManager>
<extension>
<name>AllInOne</name>
<type>JAVA</type>
<file>rwth.server.extensions.ZoneExt</file>
<propertiesFile>config.properties</propertiesFile>
<reloadMode>AUTO</reloadMode>
</extension>
<buddyList active="false">
<allowOfflineBuddyVariables>true</allowOfflineBuddyVariables>
<maxItemsPerList>100</maxItemsPerList>
<maxBuddyVariables>15</maxBuddyVariables>
<offlineBuddyVariablesCacheSize>500</offlineBuddyVariablesCacheSize>
<customStorageClass></customStorageClass>
<useTempBuddies>true</useTempBuddies>
<buddyStates class="java.util.Arrays$ArrayList">
<a class="string-array">
<string>Available</string>
<string>Away</string>
<string>Occupied</string>
</a>
</buddyStates>
<badWordsFilter isActive="false"/>
</buddyList>
<databaseManager active="true">
<driverName>org.sqlite.JDBC</driverName>
<connectionString>jdbc:sqlite:extensions/AllInOne/world.db</connectionString>
<userName></userName>
<password></password>
<testSql>SELECT COUNT(*) FROM users;</testSql>
<maxActiveConnections>10</maxActiveConnections>
<maxIdleConnections>10</maxIdleConnections>
<exhaustedPoolAction>FAIL</exhaustedPoolAction>
<blockTime>3000</blockTime>
</databaseManager>
<allowUploads>true</allowUploads>
</zone>
\ No newline at end of file
SMARTFOX_PATH=/Applications/SmartFoxServer_2X/SFS2X
cp $SMARTFOX_PATH/lib/sqlite-jdbc-3.23.1.jar sqlite-jdbc-3.23.1.jar
cp $SMARTFOX_PATH/zones/World.zone.xml World.zone.xml
rm -r config
rm -r visualization
rm -r AllInOne
cp -r $SMARTFOX_PATH/config config
cp -r $SMARTFOX_PATH/www/visualization ./visualization
cp -r $SMARTFOX_PATH/extensions/AllInOne .
docker build -t smartfox .
version: "3"
services:
smartfox:
image: smartfox:latest
ports:
- 8080:8080 # visualization service
- 9933:9933 # admin panel
- 8787:8787 # jvm debug port
depends_on:
- rmi-server
links:
- rmi-server
restart: always
rmi-server:
image: rmi-server:latest
ports:
- 10101:10101
restart: always
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment