Skip to content

This repository contains a prototype of TicTacSnow, a containerised game to deploy on Snowpark Container Services.

License

Notifications You must be signed in to change notification settings

sfc-gh-mconsoli/tictacsnow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TicTacSnow

This repository contains a prototype of TicTacSnow, a containerised game to deploy on Snowpark Container Services.

TicTacSnow Screenshot

Getting Started

Pre-Reqs (Local and Remote)

  1. Docker Desktop installed
  2. Python 3.10 installed
  3. A non-trial Snowflake account in a supported AWS region.

NOTE: Pre-reqs based on steps 1-2-3 of this Hands-On-Lab

Snowflake Configs

  1. Run the setup/setup.sql code as ACCOUNTADMIN (re-used step 2 of the Quick Start linked above).

Locally Build & Push

To get started with TicTacSnow, follow these instructions:

  1. Clone the repository to your local machine:
git clone https://github.com/matteo-consoli/tictacsnow/
  1. Build the Docker image locally:
# open terminal in the cloned folder
cd app
docker build -t tic-tac-toe .
  1. Login to the Snowflake Container Registry. Your <snowflake_registry_hostname> is -.registry.snowflakecomputing.com .
docker login <snowflake_registry_hostname> -u <username>
# Enter your password when prompted
  1. Tag the Docker image:
docker tag tic-tac-toe:latest <snowflake_registry_hostname>/container_hol_db/public/image_repo/tic-tac-toe:dev
  1. Check the list of Docker images:
docker image list
  1. Push the Docker image to the Snowflake Container Registry:
docker push <snowflake_registry_hostname>/container_hol_db/public/image_repo/tic-tac-toe:dev

Snowflake Deployment

  1. Load Yaml on stage CONTAINER_HOL_DB.PUBLIC.SPECS.

    Before uploading it, don’t forget to replace <snowflake_registry_hostname> with the value of your account: <your_org-your_account>.registry.snowflakecomputing.com

  2. Check the Loaded File via SQL command:

USE ROLE CONTAINER_USER_ROLE;
LS @CONTAINER_HOL_DB.PUBLIC.SPECS;
  1. Create the new service: tic_tac_toe_service
-- Drop command in case you are creating the service again
-- DROP SERVICE IF EXISTS CONTAINER_HOL_DB.PUBLIC.tic_tac_toe_service;

CREATE SERVICE CONTAINER_HOL_DB.PUBLIC.tic_tac_toe_service
    in compute pool CONTAINER_HOL_POOL
    from @specs
    spec='tic-tac-toe-spcs.yaml';
  1. Check the Service status. It might take a few minutes before the status "READY".
-- Check Status
CALL SYSTEM$GET_SERVICE_STATUS('CONTAINER_HOL_DB.PUBLIC.tic_tac_toe_service');
-- Once ready you'll have the status "READY", message "RUNNING"

-- Check Logs
SELECT SYSTEM$GET_SERVICE_LOGS('CONTAINER_HOL_DB.PUBLIC.tic_tac_toe_service', 0, 'tic-tac-toe', 50);
  1. Check the Service Endpoint assigned. It might take a few minutes before an endpoint is available. Once available copy it and paste it in a new window (not logged in).
SHOW ENDPOINTS IN SERVICE tic_tac_toe_service;
  1. Create a new user and role and use it in a new window to access your TicTacSnow instance!
-- Create your own user and password. 
-- The user accessing TicTacSnow must have CONTAINER_USER_ROLE as default role.

CREATE USER TICTACSNOWPLAYER IDENTIFIED BY 'tictacsnow2024' DEFAULT_ROLE = 'CONTAINER_USER_ROLE';
GRANT ROLE CONTAINER_USER_ROLE to USER TICTACSNOWPLAYER;
  1. Login with the new credentials created and have fun!

Contributing

Contributions are welcome! If you have any ideas, suggestions, or improvements for TicTacSnow, feel free to reach me out on Linkedin.

NOTE

Don't forget to replace <snowflake_registry_hostname> with the appropriate values for your project: .registry.snowflakecomputing.com

About

This repository contains a prototype of TicTacSnow, a containerised game to deploy on Snowpark Container Services.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published