Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build & docker image #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@ RUN ./configure --without-ssl --disable-shared
RUN make
RUN make DESTDIR=/root/fs-out install

WORKDIR /root/
RUN curl -L https://codeload.github.com/redis/hiredis/tar.gz/v1.1.0 > hiredis.tar.gz
RUN mkdir hiredis-src hiredis-bin
RUN tar -xvzf hiredis.tar.gz --strip 1 -C hiredis-src
WORKDIR hiredis-bin
RUN cmake -DCMAKE_BUILD_TYPE="Release" ../hiredis-src
RUN make
RUN make DESTDIR=/root/fs-out install

WORKDIR /root/
RUN curl -L https://codeload.github.com/alanxz/rabbitmq-c/tar.gz/v0.9.0 > rabbitmq.tar.gz
RUN mkdir rabbitmq-src rabbitmq-bin
RUN tar -xvzf rabbitmq.tar.gz --strip 1 -C rabbitmq-src
WORKDIR rabbitmq-bin
RUN cmake -DCMAKE_BUILD_TYPE="Release" -DENABLE_SSL_SUPPORT="OFF" ../rabbitmq-src
RUN cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_INCLUDEDIR="include/rabbitmq-c" -DENABLE_SSL_SUPPORT="OFF" ../rabbitmq-src
RUN make
RUN make DESTDIR=/root/fs-out install

Expand All @@ -45,14 +54,15 @@ RUN curl -L http://github.com/zeux/pugixml/releases/download/v1.9/pugixml-1.9.ta
RUN mkdir pugixml-src pugixml-bin
RUN tar -xvzf pugixml.tar.gz --strip 1 -C pugixml-src
WORKDIR pugixml-bin
RUN cmake -DCMAKE_BUILD_TYPE="Release" ../pugixml-src
RUN cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_CXX_FLAGS="-fPIC" ../pugixml-src
RUN make
RUN make DESTDIR=/root/fs-out install

COPY code /root/code
COPY cmake /root/cmake
RUN mkdir /root/os-bin /root/os-make
WORKDIR /root/os-make
run cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code
run cmake -DCMAKE_PREFIX_PATH="/root/fs-out/usr/local" -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -I/root/fs-out/usr/local/include/rabbitmq-c -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/ -pthread" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code
run make
RUN mkdir -p /root/fs-out/opt/openspy/bin /root/fs-out/opt/openspy/lib
RUN mv /root/os-make/bin/* /root/fs-out/opt/openspy/bin
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ This is a full rewrite of the old openspy. Each service runs as a seperate proce
## Building
A [docker file](Dockerfile) has been created to convey the required build and runtime environment. This has not been used for development, but can be helpful for testing and just getting the project running.

```sh
git clone https://github.com/chc/openspy-core-v2.git
cd openspy-core-v2
docker build -t os-core .
docker-compose up
```

## Running
If you refer to the "openspy-web-backend" project, this will have everything you need to get openspy running.
From the perspective of this application, the requirements are redis, rabbitmq, and then the openspy-web-backend.
Expand Down
28 changes: 28 additions & 0 deletions cmake/modules/Findrabbitmq-c.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

find_package(PkgConfig QUIET)
pkg_check_modules(PC_RABBITMQ QUIET rabbitmq)

find_path(RABBITMQ_INCLUDE_DIR
NAMES rabbitmq-c/amqp.h
HINTS ${PC_RABBITMQ_INCLUDEDIR} ${PC_RABBITMQ_INCLUDE_DIRS})

find_library(RABBITMQ_LIBRARY
NAMES rabbitmq librabbitmq
HINTS ${PC_RABBITMQ_LIBDIR} ${PC_RABBITMQ_LIBRARY_DIRS})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(rabbitmq
REQUIRED_VARS RABBITMQ_LIBRARY RABBITMQ_INCLUDE_DIR)

if (RABBITMQ_FOUND)
set(RABBITMQ_LIBRARIES ${RABBITMQ_LIBRARY})
set(RABBITMQ_INCLUDE_DIRS ${RABBITMQ_INCLUDE_DIR})
if (NOT TARGET rabbitmq::rabbitmq)
add_library(rabbitmq::rabbitmq UNKNOWN IMPORTED)
set_target_properties(rabbitmq::rabbitmq PROPERTIES
IMPORTED_LOCATION "${RABBITMQ_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${RABBITMQ_INCLUDE_DIR}")
endif ()
endif ()

mark_as_advanced(RABBITMQ_INCLUDE_DIR RABBITMQ_LIBRARY)
2 changes: 1 addition & 1 deletion code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

#Where to find local cmake scripts
set(OS_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake/modules)
Expand Down
2 changes: 1 addition & 1 deletion code/FESL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(FESL)

Expand Down
2 changes: 1 addition & 1 deletion code/GP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(GP)

Expand Down
2 changes: 1 addition & 1 deletion code/cdkey/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(cdkey)

Expand Down
8 changes: 4 additions & 4 deletions code/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(openspy_core)

Expand Down Expand Up @@ -111,7 +111,7 @@ IF(WIN32)
set (ALL_PLAT ${PLAT_THREAD_SRCS} ${PLAT_THREAD_HDRS} ${PLAT_LOGGER_SRCS} ${PLAT_LOGGER_HDRS} ${PLAT_TIMER_SRCS} ${PLAT_TIMER_HDRS})
add_library (openspy SHARED ${ALL_SRCS} ${ALL_PLAT})
target_link_libraries(openspy ws2_32.lib ${CURL_LIBRARIES} pugixml rabbitmq::rabbitmq ${JANSSON_LIBRARIES} ${hiredis_LIBRARIES} ${SSL_LIBS})
add_compile_definitions(EVTMGR_USE_SELECT=1)
add_definitions(-DEVTMGR_USE_SELECT=1)
ELSE() #unix

file(GLOB PLAT_THREAD_SRCS "OS/Threads/PThreads/*.cpp")
Expand All @@ -136,9 +136,9 @@ ELSE() #unix
add_library (openspy SHARED ${ALL_SRCS} ${ALL_PLAT})
target_link_libraries(openspy pthread ${CURL_LIBRARIES} z pugixml rabbitmq::rabbitmq ${JANSSON_LIBRARIES} ${hiredis_LIBRARIES} ${SSL_LIBS})
if(APPLE)
add_compile_definitions(EVTMGR_USE_SELECT=1)
add_definitions(-DEVTMGR_USE_SELECT=1)
else()
add_compile_definitions(EVTMGR_USE_EPOLL=1)
add_definitions(-DEVTMGR_USE_EPOLL=1)
endif()
ENDIF()

Expand Down
2 changes: 1 addition & 1 deletion code/core/OS/MessageQueue/rabbitmq/rmqConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <OS/Thread.h>
#include <OS/Task.h>
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/tcp_socket.h>
#include <rabbitmq-c/amqp_tcp_socket.h>
namespace MQ {
class rmqListenerData {
public:
Expand Down
4 changes: 3 additions & 1 deletion code/core/SSL/OpenSSL/SSL/SSLIOInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

#include <OS/SSL.h>

#include <openssl/configuration.h>
//#include <openssl/configuration.h>
#include <openssl/opensslconf.h>

#include <openssl/ssl.h>

namespace SSLNetIOIFace {
Expand Down
2 changes: 1 addition & 1 deletion code/gamestats/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(gstats)

Expand Down
2 changes: 1 addition & 1 deletion code/natneg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(natneg)

Expand Down
2 changes: 1 addition & 1 deletion code/peerchat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(peerchat)

Expand Down
2 changes: 1 addition & 1 deletion code/qr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(qr)

Expand Down
2 changes: 1 addition & 1 deletion code/search/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(SM)

Expand Down
2 changes: 1 addition & 1 deletion code/serverbrowsing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(serverbrowsing)

Expand Down
2 changes: 1 addition & 1 deletion code/test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(serverbrowsing_test)

Expand Down
2 changes: 1 addition & 1 deletion code/test/qr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

add_subdirectory(v2)
2 changes: 1 addition & 1 deletion code/test/qr/v2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(qr_test)

Expand Down
2 changes: 1 addition & 1 deletion code/test/serverbrowsing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(serverbrowsing_test)

Expand Down
2 changes: 1 addition & 1 deletion code/test/serverbrowsing/V1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(serverbrowsing_v1_test)

Expand Down
2 changes: 1 addition & 1 deletion code/test/serverbrowsing/V2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(serverbrowsing_v2_test)

Expand Down
2 changes: 1 addition & 1 deletion code/utmaster/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.22)
cmake_minimum_required (VERSION 3.5)

project(utmaster)

Expand Down
14 changes: 13 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
natneg:
ports:
- "27901:30695"
command: /opt/openspy/bin/qr
command: /opt/openspy/bin/natneg
env_file: .env-local
image: os-core
GP:
Expand All @@ -30,12 +30,24 @@ services:
command: /opt/openspy/bin/SM
env_file: .env-local
image: os-core
cdkey:
ports:
- "29910:30835"
command: /opt/openspy/bin/cdkey
env_file: .env-local
image: os-core
gstats:
ports:
- "29920:30836"
command: /opt/openspy/bin/gstats
env_file: .env-local
image: os-core
peerchat:
ports:
- "6667:30771"
command: /opt/openspy/bin/peerchat
env_file: .env-local
image: os-core
FESL-bf2142:
ports:
- "18300:30837"
Expand Down
24 changes: 24 additions & 0 deletions docker-support/openspy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@
</driver>
</drivers>
</application>
<application name="cdkey">
<drivers>
<driver name="keyserver">
<addresses>
<address>
<ip>0.0.0.0</ip>
<port>30835</port>
</address>
</addresses>
</driver>
</drivers>
</application>
<application name="peerchat">
<drivers>
<driver name="chatserver">
<addresses>
<address>
<ip>0.0.0.0</ip>
<port>30771</port>
</address>
</addresses>
</driver>
</drivers>
</application>
<application name="FESL">
<drivers>
<driver name="bf2142pc-server">
Expand Down