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

Add info for deploying to Azure Containers #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ This project gives you a turn key solution for tranforming slack into a chess cl

To start the Slack Integration Guide you will need the IP or URL of your server. If you don't already have a place to host slackchess, you can follow the Digital Ocean Setup Guide first. After the Slack Integration is setup, you should follow the Server Setup Guide. The Server Setup Guide will guide you through pulling down the [docker image](https://hub.docker.com/r/loganjspears/slackchess/) and running it as a container.

Alternatively, you can use the Azure Container Instances Setup Guide to run your docker container on Microsoft Azure.

### Digital Ocean Setup Guide

1. Signup for Digital Ocean if you don't have an account (https://m.do.co/c/f4609bed935c referal link to get $10 free)
Expand Down Expand Up @@ -66,6 +68,36 @@ docker ps

Thats it!

### Azure Container Instances Setup Guide

This will walk you through getting the `slackchess` container image running on Azure. You will need an Azure developer account - check out [this site](https://azure.microsoft.com/en-us/free/) to get started. You will also need the Azure Command Line Interface (CLI) to communicate with Azure. Follow [these instructions](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) for your platform.

This guide was prepared by modifying the steps in [this tutorial](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-tutorial-prepare-acr) for setting up a docker container instance on Azure.

1. With the Azure CLI installed, open a terminal (command prompt) window and type: `az login`
* Follow any login steps required.
2. `docker pull loganjspears/slackchess`
3. Create a resource group for your slackchess resources: `az group create --name slackchess --location eastus`
4. Create an Azure Container Registry in the new resource group using `az acr create --resource-group slackchess --name yourACRName --sku Basic --admin-enabled true`
* Replace `yourACRName` with a unique name of your choosing. Replace this value in all subsequent commands as well.
5. `az acr login --name yourACRName`
6. `az acr show --name yourACRName --query loginServer --output table` to get the full loginServer name for your container registry.
* Use the output from this command to replace the value `yourACRLoginServer.azurecr.io` in subsequent commands.
7. `docker tag loganjspears/slackchess yourACRLoginServer.azurecr.io/slackchess:v1`
8. `docker push yourACRLoginServer.azurecr.io/slackchess:v1`
9. Check `az acr repository list --name yourACRName --output table` to see if your push succeeded. If so, you will see a `slackchess` container.
10. `az acr credential show --name yourACRName --query "passwords[0].value"` to get the password for your container registry.
11. The next couple steps are a bit of a chicken-and-the-egg situation. You need two things: the Slack integration webhook token, to give to the Azure container instance as an environment variable. And the fully qualified domain name (FQDN) for your container, to give to the Slack integration as a URL.
* Since you will not be able to create an Azure container instance for the server without a unique label, and you will not know if it's an acceptable name until you try, it's best to start with creating the Slack integration. So:
1. Run the first 3 steps in the Slack Integration Guide, stopping when you get to the URL.
2. Copy the value from the Token field of the Slack Integration.
3. Choose a unique label for your chess server's fully qualified DNS name.
4. Run this container creation command in your terminal, substituting `yourSlackIntegrationToken` with the token field value you copied above, `yourDNSLabel` with your chosen label, and `yourPassword` with the container registry password from earlier.
* `az container create --resource-group slackchess --name slackchess --image yourACRLoginServer.azurecr.io/slackchess:v1 --cpu 1 --memory 1 --registry-login-server yourACRLoginServer.azurecr.io --registry-username yourACRName --registry-password "yourPassword" --dns-name-label yourDNSLabel --environment-variables TOKEN=yourSlackIntegrationToken URL=http://yourDNSLabel.eastus.azurecontainer.io:5000 --ports 80 5000`
* If `yourDNSLabel` is already in use, this command will abort and tell you so. Try again with a different value for `yourDNSLabel`, substituting it in *both* locations in the command.
12. Once your command has succeeded, use the same full URL (including port 5000) from the command as the URL field value in the Slack Integration. Finish the remaining steps in the Slack Integration Guide.
13. Open that same URL in a browser. If your container was set up successfully, you will get the response `up` in your browser.

## Commands

Play against user:
Expand Down