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

Building a container to install from Docker or Portainer #658

Open
tempusthales opened this issue Dec 3, 2023 · 7 comments
Open

Building a container to install from Docker or Portainer #658

tempusthales opened this issue Dec 3, 2023 · 7 comments

Comments

@tempusthales
Copy link

Hey Jack as you requested I'm opening this thread for visibility and benefits of others pursuing to do the same. While I proficient with scripting and some development, I am a Docker & Docker Composer Noob and I mostly use Portainer to deploy my own Docker projects, so I'm aiming to build a deploy-able Docker Container of Crypter File Transfer and if possible deploy it via Portainer.

Based on our last convo over Ko-Fi:

The best way to run the project locally would be through the docker-compose "dev' profile. More info: https://github.com/Crypter-File-Transfer/Crypter/blob/main/Documentation/Development/Development%20Environment%20Setup.md#run-everything

Open an issue or a discussion topic on the repo if you need more support. Better for the community if we have this discussion over there.
To further clarify, those "web instructions are designed for my cloud use-case, where I have distinct "Web" and "DB" servers. The "dev" profile is designed for local development scenarios, as well as single-host environments.

I think this is a good place to start. Again thanks for your help!

@Jack-Edwards
Copy link
Member

The outcome of this issue should be a good markdown file that gets added somewhere to the repo.

A couple more comments since that conversation in Ko-Fi occurred:

  • Release v1.9.9 contains many changes that improve the support for persistent, self-hosted environments. Notable improvements are configurable CORS domains and the option to run database migrations on API startup. These settings are found in the API's appsettings.json file.
  • The "dev" profile I mentioned was initially intended to support local development with self-hosted environments being an after-thought. The profile is now named "local" to better indicate the profile is meant for "I want to run everything on this particular host" scenarios.

@tempusthales
Copy link
Author

Could you give an example of what would go in these variables?

${API_IMAGE_NAME} 
${WEB_IMAGE_NAME}
${CADDY_DOMAIN}
${CADDY_REDIRECT_TO_WWW}
${CADDY_OPTIONS}
${CADDY_TLS_VOLUME}
${CADDY_MAX_REQUEST_BODY}
${API_STORAGE_PATH}
${API_SETTINGS_FILE}
${POSTGRES_HOST}
${POSTGRES_USER_PASSWORD}
${POSTGRES_HANGFIRE_HOST}
${POSTGRES_HANGFIRE_USER_PASSWORD}
${WEB_BIND_PORT}
${WEB_SECURE_BIND_PORT}

@Jack-Edwards
Copy link
Member

If you are building the images locally and running every service on the same host, you would leave most of those options alone. Their current values in the repo are configured for single-host, self-hosted scenarios.

Specific options that may need to be set:

  • CADDY_DOMAIN
    • If you have a custom domain, then set that here. For example, www.crypter.dev.
  • CADDY_REDIRECT_TO_WWW
    • I set this to crypter.dev to redirect all traffic to the www subdomain.
  • WEB_BIND_PORT
    • Listen for HTTP traffic on this port.
  • WEB_SECURE_BIND_PORT
    • Listen for HTTPS traffic on this port.
  • POSTGRES_USER_PASSWORD
    • Provide a cryptographically strong password here. A default password is provided, but it's clearly not secure.
  • POSTGRES_HANGFIRE_USER_PASSWORD
    • Provide a cryptographically strong password here. Same logic as above.
  • API_SETTINGS_FILE
    • Any path on the filesystem. Drop your API's appsettings.json file here.

@tempusthales
Copy link
Author

If you build the images locally and run every service on the same host, you would leave most of those options alone. Their current values in the repo are configured for single-host, self-hosted scenarios.

I tried leaving those variables alone, but when I compiled them in Portainer, I would get a ton of errors. I was wondering if the content I added to the variables was wrong, so I wanted to double-verify with you first.

@Jack-Edwards
Copy link
Member

Jack-Edwards commented Dec 8, 2023 via email

@tempusthales
Copy link
Author

tempusthales commented Dec 11, 2023

I've never worked with Portainer before.

Portainer is Docker with a web ui. In the case of loading a docker compose file I get the following:
image

That is why I asked (again I'm a docker noob) about the variables... I guess I'll just do that since you explained how to fill in the blanks.

What should I use in this variable? You didn't include it on the list above:

ghcr.io/crypter-file-transfer/${API_IMAGE_NAME:-crypter_api}:latest

@Jack-Edwards
Copy link
Member

Just now seeing this. Apologies.

My first thought it Portainer is not observing the .env file in the root of the repo. Portainer suggest renaming the .env file to stack.env if I'm reading this correctly. Worth a shot. https://www.portainer.io/blog/using-env-files-in-stacks-with-portainer

The :- syntax in that variable name means if a value for API_IMAGE_NAME is not provided, then the value will default to crypter_api. Leaving it as crypter_api is fine, though make sure you are always building the image locally before you try running the container. Otherwise you risk pulling the image from GHCR. As a preventative measure, you may just want to delete the image definitions from the compose file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants