Code Monkey home page Code Monkey logo

tictacsnow's Introduction

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

tictacsnow's People

Contributors

sfc-gh-mconsoli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.