10 Commits

Author SHA1 Message Date
5b49e5d584 proper ci cd
All checks were successful
continuous-integration/drone/tag Build is passing
2025-11-30 01:23:51 +05:30
55aac72bd2 git gud
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-29 23:24:30 +05:30
b10639316e adding port as defaults to 7340
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-29 23:15:50 +05:30
d782832fc5 logging connection params
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-29 23:08:27 +05:30
b25cd1a039 logging connection params
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-29 23:06:34 +05:30
e269dfc208 direct push
All checks were successful
continuous-integration/drone/push Build is passing
2025-11-29 19:28:08 +05:30
066f8fbea5 fixes 2025-11-29 19:27:59 +05:30
4a3daf7d8c SSL configuration in Dockerfile and drone.yml
Some checks reported errors
continuous-integration/drone/tag Build was killed
2025-11-29 19:22:06 +05:30
13ad4e08d2 SSL configuration
All checks were successful
continuous-integration/drone/tag Build is passing
2025-11-29 19:16:15 +05:30
7e35cf0c31 fixes
All checks were successful
continuous-integration/drone/tag Build is passing
2025-11-29 19:04:17 +05:30
5 changed files with 23 additions and 8 deletions

View File

@@ -70,6 +70,8 @@ steps:
from_secret: WS_PORT from_secret: WS_PORT
WS_SKEY: WS_SKEY:
from_secret: WS_SKEY from_secret: WS_SKEY
WS_SSL:
from_secret: WS_SSL
volumes: volumes:
- name: dockersock - name: dockersock
path: /var/run/docker.sock path: /var/run/docker.sock
@@ -82,6 +84,7 @@ steps:
--build-arg VITE_WS_HOST="$WS_HOST" \ --build-arg VITE_WS_HOST="$WS_HOST" \
--build-arg VITE_WS_PORT="$WS_PORT" \ --build-arg VITE_WS_PORT="$WS_PORT" \
--build-arg VITE_WS_SKEY="$WS_SKEY" \ --build-arg VITE_WS_SKEY="$WS_SKEY" \
--build-arg VITE_WS_SSL="$WS_SSL" \
-t lila-games/tic-tac-toe-ui:$IMAGE_TAG \ -t lila-games/tic-tac-toe-ui:$IMAGE_TAG \
-t lila-games/tic-tac-toe-ui:latest \ -t lila-games/tic-tac-toe-ui:latest \
/drone/src /drone/src
@@ -118,7 +121,7 @@ steps:
path: /var/run/docker.sock path: /var/run/docker.sock
commands: commands:
- echo "🛑 Stopping old container..." - echo "🛑 Stopping old container..."
- docker rm -f blog || true - docker rm -f tic-tac-toe-ui || true
- name: run-container - name: run-container
image: docker:24 image: docker:24
@@ -131,8 +134,8 @@ steps:
- echo "🚀 Starting container lila-games/tic-tac-toe-ui:$IMAGE_TAG ..." - echo "🚀 Starting container lila-games/tic-tac-toe-ui:$IMAGE_TAG ..."
- | - |
docker run -d \ docker run -d \
--name blog \ --name tic-tac-toe-ui \
-p 3002:3000 \ -p 3003:3000 \
-e NODE_ENV=production \ -e NODE_ENV=production \
--restart always \ --restart always \
lila-games/tic-tac-toe-ui:$IMAGE_TAG lila-games/tic-tac-toe-ui:$IMAGE_TAG

View File

@@ -17,11 +17,12 @@ COPY . .
ARG VITE_WS_HOST ARG VITE_WS_HOST
ARG VITE_WS_PORT ARG VITE_WS_PORT
ARG VITE_WS_SKEY ARG VITE_WS_SKEY
ARG VITE_WS_SSL
# Export them as actual environment variables (Vite needs ENV) # Export them as actual environment variables (Vite needs ENV)
ENV VITE_WS_HOST=${VITE_WS_HOST} ENV VITE_WS_HOST=${VITE_WS_HOST}
ENV VITE_WS_PORT=${VITE_WS_PORT} ENV VITE_WS_PORT=${VITE_WS_PORT}
ENV VITE_WS_SKEY=${VITE_WS_SKEY} ENV VITE_WS_SSL=${VITE_WS_SSL}
# Build # Build
RUN npm run build RUN npm run build

View File

@@ -1,6 +1,6 @@
{ {
"name": "tictactoe-vite", "name": "tictactoe-vite",
"version": "v0.2.2", "version": "v1.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -46,11 +46,19 @@ export interface NakamaContextType {
export const NakamaContext = createContext<NakamaContextType>(null!); export const NakamaContext = createContext<NakamaContextType>(null!);
export function NakamaProvider({ children }: { children: React.ReactNode }) { export function NakamaProvider({ children }: { children: React.ReactNode }) {
console.log(
"[Nakama] Initializing...",
// import.meta.env.VITE_WS_SKEY,
import.meta.env.VITE_WS_HOST,
import.meta.env.VITE_WS_PORT,
import.meta.env.VITE_WS_SSL === "true"
);
const [client] = useState( const [client] = useState(
() => new Client( () => new Client(
import.meta.env.VITE_WS_SKEY, import.meta.env.VITE_WS_SKEY,
import.meta.env.VITE_WS_HOST, import.meta.env.VITE_WS_HOST,
import.meta.env.VITE_WS_PORT import.meta.env.VITE_WS_PORT,
import.meta.env.VITE_WS_SSL === "true"
) )
); );
@@ -116,8 +124,10 @@ export function NakamaProvider({ children }: { children: React.ReactNode }) {
const newSession = await getSession(username); const newSession = await getSession(username);
setSession(newSession); setSession(newSession);
// create a socket (new Nakama 3.x signature) const s = client.createSocket(
const s = client.createSocket(undefined, undefined); // no SSL on localhost import.meta.env.VITE_WS_SSL === "true",
undefined
);
await s.connect(newSession, true); await s.connect(newSession, true);
setSocket(s); setSocket(s);
socketRef.current = s; socketRef.current = s;

1
src/vite-env.d.ts vendored
View File

@@ -4,6 +4,7 @@ interface ImportMetaEnv {
readonly VITE_WS_HOST: string; readonly VITE_WS_HOST: string;
readonly VITE_WS_PORT: string; readonly VITE_WS_PORT: string;
readonly VITE_WS_SKEY: string; readonly VITE_WS_SKEY: string;
readonly VITE_WS_SSL: string;
} }
interface ImportMeta { interface ImportMeta {